1 2 3 4 5 6 7 8 9 10 11 |
wx.showModal({ title: '提示' , content: '这是一个模态弹窗' , success: function(res) { if (res.confirm) { console.log( '用户点击确定' ) } else if (res.cancel) { console.log( '用户点击取消' ) } } }) |
1 2 3 4 5 6 7 8 9 |
wx.showActionSheet({ itemList: [ 'A' , 'B' , 'C' ], success: function(res) { console.log(res.tapIndex) }, fail: function(res) { console.log(res.errMsg) } }) |
1 2 3 4 5 |
<picker bindchange= "bindPickerChange" value= "{{index}}" range= "{{array}}" > <view class = "picker" > 当前选择:{{array[index]}} </view> </picker> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Page({ /** *array:普通选择器下拉的数据 *index:默认显示的时下标为0的数据 */ data: { array: [ '美国' , '中国' , '巴西' , '日本' ], index: 0, }, bindPickerChange: function (e) { console.log( 'picker下拉项发生变化后,下标为:' , e.detail.value) this .setData({ index: e.detail.value }) }, }) |
1 2 3 4 5 6 7 8 |
<view class = "section" > <view class = "section__title" >多列选择器</view> <picker mode= "multiSelector" bindchange= "bindMultiPickerChange" bindcolumnchange= "bindMultiPickerColumnChange" value= "{{multiIndex}}" range= "{{multiArray}}" > <view class = "picker" > 当前选择:{{multiArray[0][multiIndex[0]]}},{{multiArray[1][multiIndex[1]]}},{{multiArray[2][multiIndex[2]]}} </view> </picker> </view> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
Page({ /** *multiArray:多列选择的二位数组 *multiIndex:默认显示的每列的下标 &nb |