• 微信小程序组件form


    表单组件form:官方文档

    Demo Code:

    Page({
      formSubmit: function(e) {
        console.log('form发生了submit事件,携带数据为:', e.detail.value)
      },
      formReset: function() {
        console.log('form发生了reset事件')
      }
    })
    JS
    <form bindsubmit="formSubmit" bindreset="formReset">
      <view class="section section_gap">
        <view class="section__title">switch</view>
        <switch name="switch"/>
      </view>
      <view class="section section_gap">
        <view class="section__title">slider</view>
        <slider name="slider" show-value ></slider>
      </view>
    
      <view class="section">
        <view class="section__title">input</view>
        <input name="input" placeholder="please input here" />
      </view>
      <view class="section section_gap">
        <view class="section__title">radio</view>
        <radio-group name="radio-group">
          <label class="checkbox"><radio value="radio1"/>radio1</label>
          <label class="checkbox"><radio value="radio2"/>radio2</label>
        </radio-group>
      </view>
      <view class="section section_gap">
        <view class="section__title">checkbox</view>
        <checkbox-group name="checkbox">
          <label class="checkbox"><checkbox value="checkbox1"/>checkbox1</label>
          <label class="checkbox"><checkbox value="checkbox2"/>checkbox2</label>
        </checkbox-group>
      </view>
      <view class="btn-area">
        <button formType="submit">Submit</button>
        <button formType="reset">Reset</button>
      </view>
    </form>
    WXML
    .section__title{
        font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        padding:5px;
    }
    label{
        font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    }
    .section_gap{
        margin-top: 10px;
    }
    .checkbox{
        display:block;
        margin-left:10px;
        margin-top:5px;
    }
    WXSS
  • 相关阅读:
    jquery+ajax+ashx。ashx的使用方法
    如何在ashx页面获取Session值
    模式DIV。
    .net 中文传参
    5分钟无操作,退出,操作方法,关闭页面
    SQL Server DATEDIFF() 函数(SQL计算时间差)
    Sql server 事务的两种用法
    正则表达式相关
    jQuery AJAX实现调用页面后台方法。调用ashx方法
    时间差(类.精确到秒).net中实现Datediff类C#
  • 原文地址:https://www.cnblogs.com/betterlife/p/5969060.html
Copyright © 2020-2023  润新知