| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import App from './App'
- import './permission'
- import languages from './locale/index'
- import {
- setupPinia
- } from './store';
- import {
- createSSRApp
- } from 'vue'
- // #ifdef APP-PLUS
- import { runWgtHotUpdate } from '@/utils/hot-update'
- // #endif
- import {
- createI18n
- } from 'vue-i18n'
- let i18nConfig = {
- locale: uni.getLocale(),
- messages: languages
- }
- const i18n = createI18n(i18nConfig)
- export function createApp() {
- const app = createSSRApp(App)
- setupPinia(app)
- app.use(i18n)
- // 把t函数添加到全局属性
- app.config.globalProperties.$t = i18n.global.t
- // #ifdef APP-PLUS
- // uni-app 的页面 onShow 会应用全局 mixin,因此任意页面显示时都能触发检查。
- // 热更新模块内部负责并发合并和三十秒去重,不会因页面切换连续请求或弹窗。
- app.mixin({
- onShow() {
- runWgtHotUpdate()
- }
- })
- // #endif
- return {
- app,
- }
- }
|