js文件
import { getSetting,chooseAddress,openSetting} from "../../utils/asyncWx.js";
import regeneratorRuntime from '../../lib/runtime/runtime.js';
async address(){
//获取收货地址
const res1=await getSetting();
const scopeAddress=res1.authSetting["scope.address"];
if(scopeAddress===true||scopeAddress===undefined){
const res2=await chooseAddress();
console.log(res2);
}else{
await openSetting();
const res2=await chooseAddress();
console.log(res2);
}
}
asyncWx.js
export const getSetting=()=>{
return new Promise((resolve,reject)=>{
wx.getSetting({
success: (result) => {
resolve(result);
},
fail: (err) => {
reject(err);
}
});
})
}
export const chooseAddress=()=>{
return new Promise((resolve,reject)=>{
wx.chooseAddress({
success: (result) => {
resolve(result);
},
fail: (err) => {
reject(err);
}
});
})
}
export const openSetting=()=>{
return new Promise((resolve,reject)=>{
wx.openSetting({
success: (result) => {
resolve(result);
},
fail: (err) => {
reject(err);
}
});
})
}
报错
Error: module "@babel/runtime/helpers/interopRequireDefault.js" is not defined
最新nightly工具更新一下试试:
https://developers.weixin.qq.com/miniprogram/dev/devtools/nightly.html
选低一点的基础库看看?
哎 需要调整基础库到2.20一下就不会报错了
没错都快2022年了 这种问题还有