# plugin_demo **Repository Path**: yx102/plugin_demo ## Basic Information - **Project Name**: plugin_demo - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-11-22 - **Last Updated**: 2022-03-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # demo3 ## Project setup ``` npm install ``` ### Compiles and hot-reloads for development ``` npm run serve ``` ### Compiles and minifies for production ``` npm run build ``` ### Lints and fixes files ``` npm run lint ``` ### Customize configuration See [Configuration Reference](https://cli.vuejs.org/config/). ### 怎么将异步的改造为同步(添加 promise) ``` 异步: wx.showModal({ title: '提示', content: '这是一个模态弹窗', success (res) { if (res.confirm) { console.log('用户点击确定') } else if (res.cancel) { console.log('用户点击取消') } } }) 改造为同步,添加promise export const showModal=({content})=>{ return new Promise((resolve,reject)=>{ wx.showModal({ title: '提示', content: content, success: (result) => { resolve(result) }, fail: (err)=>{ reject(err) } }) }) } 使用 const res = await showModal({ content: "您是否要删除?" }); if (res.confirm) { console.log('执行内容') } ```