feat: 初始化
This commit is contained in:
54
main.js
Normal file
54
main.js
Normal file
@ -0,0 +1,54 @@
|
||||
import App from './App'
|
||||
import * as Pinia from 'pinia';
|
||||
import {
|
||||
messages,
|
||||
i18n
|
||||
} from './locale/index.ts'
|
||||
import {
|
||||
locales,
|
||||
defaultLocale
|
||||
} from './utils/const';
|
||||
import CustomModal from '@/components/CustomModal/CustomModal.vue'
|
||||
import CustomModalPlugin from '@/plugins/customModalPlugin.js'
|
||||
|
||||
// import VConsole from 'vconsole';
|
||||
|
||||
// const vConsole = new VConsole();
|
||||
|
||||
const locale = uni.getLocale()
|
||||
let i18nConfig = {
|
||||
locale: locales.includes(locale) ? locale : defaultLocale,
|
||||
messages
|
||||
}
|
||||
|
||||
// #ifndef VUE3
|
||||
import Vue from 'vue'
|
||||
import VueI18n from 'vue-i18n'
|
||||
Vue.use(VueI18n)
|
||||
const i18n2 = new VueI18n(i18nConfig)
|
||||
Vue.config.productionTip = false
|
||||
App.mpType = 'app'
|
||||
const app = new Vue({
|
||||
i18n,
|
||||
CustomModalPlugin,
|
||||
...App
|
||||
})
|
||||
app.$mount()
|
||||
// #endif
|
||||
|
||||
// #ifdef VUE3
|
||||
import {
|
||||
createSSRApp
|
||||
} from 'vue'
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
app.use(Pinia.createPinia());
|
||||
app.use(i18n)
|
||||
app.use(CustomModalPlugin)
|
||||
app.component('CustomModal', CustomModal)
|
||||
return {
|
||||
app,
|
||||
Pinia
|
||||
}
|
||||
}
|
||||
// #endif
|
Reference in New Issue
Block a user