suta/main.js
2024-05-11 10:06:09 +08:00

37 lines
704 B
JavaScript

import Vue from 'vue'
import App from './App'
import './uni.promisify.adaptor'
import uView from "uview-ui"
Vue.use(uView)
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App
})
Vue.prototype.wxLogin = async function(){
console.log("wxLogin")
return await new Promise(function(reslove, reject) {
let that = this
uni.login({
success: function(res) {
console.log("main.js==>res",res)
// 获取小程序账号信息
const accountInfo = uni.getAccountInfoSync();
// 从账号信息中获取 AppID
const appid = accountInfo.miniProgram.appId;
reslove( {
"js_code": res.code,
"appid":appid
})
}
});
})
}
app.$mount()