<!--index.wxml-->
<view class="container">
<button type="primary" bindtap="btnToDo">click me...</button>
</view>
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
},
//事件处理函数
btnToDo: function() {
// // 当点击按钮触发
// // 交互操作组件,必须通过调用API方式使用
// wx.showActionSheet({
// // 显示出来的项目列表
// itemList: ['刘备', '关羽', '张飞'],
// // 点击其中任一项的回调
// success: function(res) {
// // res.cancel 指的是是否点击了取消
// if (!res.cancel) {
// // tapIndex指的是点击的下标
// console.log(res.tapIndex)
// }
// }
// })
// // 类似 Vue 的 dialog 组件
// wx.showModal({
// title: 'title',
// content: '这是一个模态弹窗',
// success: function(res) {
// if (res.confirm) {
// if (res.confirm) {
// if (res.confirm) {
// console.log('用户点击确定')
// }
// }
// }
// }
// })
wx.showToast({
title: 'title',
// 只支持 success, loading, none
icon: 'loading',
duration: 2000
})
}
})