弹出菜单--模态框

家住魔仙堡 提交于 2019-11-30 04:26:44

index.wxml

<!--index.wxml-->
<view class="container">
  <button type="primary" bindtap="btnToDo">click me....</button>
</view>

  index.js

//index.js
Page({
  data: {

  },

  btnToDo: function () {
    // 当点击按钮触发
    // console.log(1111)
    // 交互操作组件 必须通过调用API方式使用
    // wx.showActionSheet({
    //   // 显示出来的项目列表
    //   itemList: ['传智播客', '黑马程序员', '博学谷在线', '酷丁鱼'],
    //   // 点击其中任一项的回调
    //   success: function (res) {
    //     // res.cancel 指的是是否点击了取消
    //     if (!res.cancel) {
    //       // tapIndex指的是点击的下标
    //       console.log(res.tapIndex)
    //     }
    //   }
    // })

    // wx.showModal({
    //   title: '提示',
    //   content: '这是一个模态弹窗',
    //   success: function(res) {
    //     if (res.confirm) {
    //       console.log('用户点击确定')
    //     }
    //   }
    // })

    // wx.showToast({
    //   title: '成功',
    //   // 只支持 success 和 loading
    //   icon: 'loading',
    //   duration: 2000
    // })
  }
})

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!