1、封装方法并导出 将封装的方法放到util目录下的js文件中。可以新建js文件,也可以直接写在util.js文件中。 通过export导出封装的方法。 (1)确认框方法 在新建的msg.js文件中定义确认框方法,并导出。 exportlet$confirm=(content)=>{returnnewPromise(resolve=>{wx.showModal({content,success:({confirm})=>{if...
const [rejected, allowed] = await this.authorize('userLocation')const content = allowed ? '是否获取定位信息' : '是否查看授权获取地址位置情况'const getLocation = async () => { const getLocationRes = await wx.getLocation()return getLocationRes } wx.showModal({ title: '温馨提示',content,// op...
let obj = await gtopenid(_data); if(obj.openid){ // 3、代金券加签接口 this.getBuyCashCoupon(obj.openid) this.$apply() } else { if (obj.errcode == 40125) { wx.hideToast({ title: 'appsecret失效', icon: 'fail', duration: 2000 }) } } } 复制代码 1. 2. 3. 4. 5. 6. 7...
{wx.showModal({title:'提示',content:"请选择正确的图片格式上传",showCancel:false,confirmText:'确定',});}// 判断是否显示添加图片console.log("显示添加图片",chooseImgs.length);if(chooseImgs.length>0){//图如果满了9张,不显示加图if(chooseImgs.length>=9){that.setData({//隐藏加号hideAdd:...