官方文档WeUI组件介绍中actionSheet模拟IOS底部弹出操作按钮组件,在开发工具和真机无效
data: { showActionsheet: false, groups: [ { text: '示例菜单', value: 1 }, { text: '示例菜单', value: 2 }, { text: '负向菜单', type: 'warn', value: 3 } ] }, onLoad: function () { console.log('代码片段是一种迷你、可分享的小程序或小游戏项目,可用于分享小程序和小游戏的开发经验、展示组件和 API 的使用、复现开发问题和 Bug 等。可点击以下链接查看代码片段的详细文档:') console.log('https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/devtools.html') "https://developers.weixin.qq.com/s/kU6KAHmR7ocS" }, close: function () { this.setData({ showActionsheet: false }) }, btnClick(e) { console.log(e) this.close() }, showActionSheet:function(){ this.setData({ showActionsheet: true }) }}) |
json:
{ "usingComponents": { "mp-actionsheet": "/actionsheet/actionsheet" }} |
wxml:
<mp-actionSheet bindactiontap="btnClick" show="{{showActionsheet}}" actions="{{groups}}" title="这是一个标题,可以为一行或者两行。"></mp-actionSheet><button bindtap="showActionSheet">这是一个按钮</button> |
