diff --git a/App.vue b/App.vue index 2c0b3c2..23aa96d 100644 --- a/App.vue +++ b/App.vue @@ -6,7 +6,6 @@ version } from './package.json' import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update'; - import { getSessionXToken } from "@/session" import { USERKEY } from "@/store/actionKey" export default { @@ -14,8 +13,6 @@ }, onLaunch: function() { - const xToken = getSessionXToken() - // 登录认证 this.$store.dispatch(USERKEY.GETUSERINFO) // #ifdef H5 diff --git a/main.js b/main.js index 6100993..19ff2f3 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,7 @@ import App from './App' import store from './store' import uviewPlus from '@/uni_modules/uview-plus' +import { mixins } from "./mixins" // #ifndef VUE3 import Vue from 'vue' @@ -17,7 +18,7 @@ const app = new Vue({ store, ...App }) - +app.mixin(mixins); app.$mount() // #endif @@ -27,6 +28,8 @@ import { } from 'vue' export function createApp() { const app = createSSRApp(App) + + app.mixin(mixins); app.use(uviewPlus) // 调用setConfig方法,方法内部会进行对象属性深度合并,可以放心嵌套配置 // 需要在app.use(uview-plus)之后执行 @@ -50,6 +53,7 @@ export function createApp() { } }) app.use(store) + app.config.globalProperties.$adpid = "1111111111" app.config.globalProperties.$backgroundAudioData = { playing: false, diff --git a/mixins/index.js b/mixins/index.js new file mode 100644 index 0000000..2ddc3bf --- /dev/null +++ b/mixins/index.js @@ -0,0 +1,25 @@ +import getCdnUrl from "@/common/getCdnUrl" +import * as untools from "@/common/untool" +import { + corePost +} from "@/common/request" + +export const mixins = { + data() { + return { + + }; + }, + computed: {}, + created() { + console.log("我是mixin中的created生命周期函数"); + }, + // mounted() { + // console.log("我是mixin中的mounted生命周期函数"); + // }, + methods: { + ...untools, + corePost, + getCdnUrl + }, +} \ No newline at end of file diff --git a/pages/login/login.vue b/pages/login/login.vue index 8ab3909..68f8108 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -40,10 +40,7 @@