// wxml 当前选择:{{array[index]}} // jsPage({ data: { array: ['美国', '中国', '巴西'], index: 0 }, bindPickerChange: function(e) { console.log('picker 值为:', e.detail.value) this.setData({ index: e.detail.value }) }})
中包含多项
name ...
中可以绑定change
事件
// wxml... // jscheckboxChange: function(e) { console.log('value:', e.detail.value)}
sliderchange:function(e) { console.log('slider 值为', e.detail.value)}
switchChange: function (e){ console.log('switch值为', e.detail.value)}
使用form
组件,其中放入各类表单组件,然后使用submit
类型的button
触发提交事件,处理函数中可以得到所有的表单数据
// wxml// jsformSubmit: function(e) { console.log('提交的所有数据:', e.detail.value)}
联系客服