UNPKG

wux-weapp

Version:

一套组件化、可复用、易扩展的微信小程序 UI 组件库

58 lines (53 loc) 1.5 kB
import { $wuxActionSheet } from '../../dist/index' Page({ data: {}, onLoad() {}, showActionSheet1() { wx.showActionSheet({ itemList: ['实例菜单', '实例菜单'] }) }, showActionSheet2() { $wuxActionSheet().showSheet({ 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().showSheet({ theme: 'wx', titleText: '三秒后自动关闭', buttons: [{ text: '实例菜单' }, { text: '实例菜单' }, ], buttonClicked(index, item) { return true }, }) this.timeout = setTimeout(hideSheet, 3000) }, })