web前端全系列 教程
1839个小节阅读:2243.7k
目录
鸿蒙应用开发
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
显示操作菜单,菜单会从底部弹出
xxxxxxxxxx
<button type="primary" bindtap="clickActionSheetHandle">显示底部菜单栏</button>
xxxxxxxxxx
Page({
clickActionSheetHandle() {
wx.showActionSheet({
itemList: ['A', 'B', 'C'],
success(res) {
console.log(res.tapIndex)
},
fail(res) {
console.log(res.errMsg)
}
})
}
})
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
itemList | Array. | 是 | 按钮的文字数组,数组长度最大为 6 | |
itemColor | string | #000000 | 否 | 按钮的文字颜色 |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
object.success 回调函数
属性 | 类型 | 说明 |
---|---|---|
tapIndex | number | 用户点击的按钮序号,从上到下的顺序,从0开始 |
xxxxxxxxxx
Page({
data:{
citys:["北京","西安","太原","河北","内蒙"]
},
clickActionSheetHandle() {
var that = this;
wx.showActionSheet({
itemList: this.data.citys,
itemColor:"#f00",
success(res) {
console.log(that.data.citys[res.tapIndex])
},
fail(res) {
console.log(res.errMsg)
}
})
}
})
实时效果反馈
1. 在微信小程序中,下列那个属性可以获取 showActionSheet
的数据 :
A 通过 tapIndex
下标在数组中获取数据
B 通过读取itemList
获取数据
C 通过读取itemColor
获取数据
D 无法读取数据
答案
1=>A