| 1 2 3 4 5 6 7 8 9 10 11 |
wx.showModal({title: '提示',content: '這是一個模態(tài)彈窗',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"> 當(dāng)前選擇:{{array[index]}} </view></picker> |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Page({ /** *array:普通選擇器下拉的數(shù)據(jù) *index:默認(rèn)顯示的時下標(biāo)為0的數(shù)據(jù) */ data: { array: ['美國', '中國', '巴西', '日本'], index: 0, }, bindPickerChange: function (e) { console.log('picker下拉項發(fā)生變化后,下標(biāo)為:', 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">當(dāng)前選擇:{{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:多列選擇的二位數(shù)組 *multiIndex:默認(rèn)顯示的每列的下標(biāo) &nb
|