// 挂载变量 // import { // API_URL, // API_ROOT // } from '@/common/request/request'; import store from '@/common/store'; import http from '@/common/request'; import platform from '@/common/platform'; import tools from '@/common/utils/tools' // mixin混入 import mixin from '@/common/mixins'; // #ifdef H5 // uni方法重写, h5的粘贴板的设置,获取。图片视频的保存 import wxsdk from '@/common/wechat/sdk' import VConsole from 'vconsole' import '@/common/utils/sdk-h5.js' // #endif import wechat from '@/common/wechat/wechat'; const install = Vue => { // Vue.prototype.$API_URL = API_URL; // Vue.prototype.$API_ROOT = API_ROOT; // 挂载请求 Vue.prototype.$http = http; // 平台判断 Vue.prototype.$platform = platform; // 挂载工具函数 Vue.prototype.$tools = tools; Vue.mixin(mixin); // #ifdef H5 // 微信H5,sdk挂载 Vue.prototype.$wxsdk = wxsdk; // 调试微信jssdk // new VConsole() // #endif } export async function init(options) { // #ifdef H5 platform.entry(); // #endif // #ifdef MP-WEIXIN // 检测小程序更新(如果从朋友圈场景进入则无此API) options.scene !== 1154 && wechat.checkMiniProgramUpdate(); // #endif await store.dispatch("appInit", options); // 加载基本信息 //获取模板消息 await store.dispatch("getTemplate", options); // #ifdef MP-WEIXIN await store.dispatch('getMessageIds'); //订阅消息 // #endif } export default { install }