wux
Version:
微信小程序 - 自定义组件
60 lines (55 loc) • 1.07 kB
JavaScript
import { $wuxActionSheet } from '../../components/wux'
Page({
data: {},
onLoad() {},
showActionSheet1() {
wx.showActionSheet({
itemList: ['实例菜单', '实例菜单']
})
},
showActionSheet2() {
$wuxActionSheet.show({
titleText: '自定义操作',
buttons: [
{
text: 'Go Dialog'
},
{
text: 'Go Toast'
},
],
buttonClicked(index, item) {
index === 0 && wx.navigateTo({
url: '/pages/dialog/index'
})
index === 1 && wx.navigateTo({
url: '/pages/toast/index'
})
return true
},
cancelText: '取消',
cancel() {},
destructiveText: '删除',
destructiveButtonClicked() {},
})
},
showActionSheet3() {
if (this.timeout) clearTimeout(this.timeout)
const hideSheet = $wuxActionSheet.show({
theme: 'wx',
titleText: '三秒后自动关闭',
buttons: [
{
text: '实例菜单'
},
{
text: '实例菜单'
},
],
buttonClicked(index, item) {
return true
},
})
this.timeout = setTimeout(hideSheet, 3000)
},
})