微信小程序中如何从showActionSheet获取具体选项值?

2026-06-09 10:531阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计153个文字,预计阅读时间需要1分钟。

微信小程序中如何从showActionSheet获取具体选项值?

{{value}}

Page({ data: { value: }, click: function() { var ithis=this; var list=['A', 'B', 'C']; console.log(ithis); }})


<view class="container">
<button type="primary" bindtap="click">按钮</button>

<view>{{value}} </view>
</view>

Page({

/**
* 页面的初始数据
*/
data: {
value: ""
},

click: function() {
var ithis = this;
var list = ['A', 'B', 'C'];
console.log(ithis)
wx.showActionSheet({
itemList: list,
success(res) {
console.log(res.tapIndex)
console.log(res)
console.log(list)
ithis.setData({
value: list[res.tapIndex]
})
},
fail(res) {
console.log(res.errMsg)
}
})
}
})

微信小程序中如何从showActionSheet获取具体选项值?




标签:微信

本文共计153个文字,预计阅读时间需要1分钟。

微信小程序中如何从showActionSheet获取具体选项值?

{{value}}

Page({ data: { value: }, click: function() { var ithis=this; var list=['A', 'B', 'C']; console.log(ithis); }})


<view class="container">
<button type="primary" bindtap="click">按钮</button>

<view>{{value}} </view>
</view>

Page({

/**
* 页面的初始数据
*/
data: {
value: ""
},

click: function() {
var ithis = this;
var list = ['A', 'B', 'C'];
console.log(ithis)
wx.showActionSheet({
itemList: list,
success(res) {
console.log(res.tapIndex)
console.log(res)
console.log(list)
ithis.setData({
value: list[res.tapIndex]
})
},
fail(res) {
console.log(res.errMsg)
}
})
}
})

微信小程序中如何从showActionSheet获取具体选项值?




标签:微信