68 lines
1.5 KiB
JavaScript
68 lines
1.5 KiB
JavaScript
import App from './App'
|
||
import messages from './locale/index'
|
||
import uviewPlus from '@/uni_modules/uview-plus'
|
||
// #ifndef MP-WEIXIN
|
||
import VueClipboard from 'vue-clipboard2'
|
||
// #endif
|
||
|
||
let i18nConfig = {
|
||
locale: uni.getLocale(),
|
||
messages
|
||
}
|
||
|
||
// #ifndef VUE3
|
||
import Vue from 'vue'
|
||
import VueI18n from 'vue-i18n'
|
||
|
||
import '@/uni_modules/uview-plus/theme.scss' // 引入uView的样式
|
||
|
||
// #ifndef MP-WEIXIN
|
||
Vue.use(VueClipboard);
|
||
// #endif
|
||
|
||
Vue.use(uviewPlus)
|
||
Vue.use(VueI18n)
|
||
const i18n = new VueI18n(i18nConfig)
|
||
Vue.config.productionTip = false
|
||
App.mpType = 'app'
|
||
const app = new Vue({
|
||
i18n,
|
||
...App
|
||
})
|
||
app.$mount()
|
||
// #endif
|
||
|
||
// #ifdef VUE3
|
||
import { createSSRApp } from 'vue'
|
||
import { createI18n } from 'vue-i18n'
|
||
const i18n = createI18n(i18nConfig)
|
||
export function createApp() {
|
||
const app = createSSRApp(App)
|
||
// #ifdef H5
|
||
app.component('AsyncError', {
|
||
props: ['error'],
|
||
mounted() {
|
||
console.error('[AsyncPageError]', this.error)
|
||
},
|
||
render() {
|
||
const detail = import.meta.env.DEV && this.error
|
||
? `:${this.error.message || String(this.error)}`
|
||
: ''
|
||
return h('div', {
|
||
class: 'uni-async-error',
|
||
onClick: () => window.location.reload()
|
||
}, `页面加载失败${detail},点击屏幕重试`)
|
||
}
|
||
})
|
||
// #endif
|
||
// #ifndef MP-WEIXIN
|
||
app.use(VueClipboard);
|
||
// #endif
|
||
app.use(i18n)
|
||
app.use(uviewPlus)
|
||
return {
|
||
app
|
||
}
|
||
}
|
||
// #endif
|