47 lines
981 B
JavaScript
47 lines
981 B
JavaScript
import App from './App'
|
||
import messages from './locale/index'
|
||
import uviewPlus from '@/uni_modules/uview-plus'
|
||
import { createSSRApp, h } from 'vue'
|
||
import { createI18n } from 'vue-i18n'
|
||
|
||
// #ifdef H5
|
||
import VueClipboard from 'vue-clipboard2'
|
||
// #endif
|
||
|
||
const i18nConfig = {
|
||
locale: uni.getLocale(),
|
||
messages
|
||
}
|
||
|
||
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},点击屏幕重试`)
|
||
}
|
||
})
|
||
app.use(VueClipboard);
|
||
// #endif
|
||
|
||
app.use(i18n)
|
||
app.use(uviewPlus)
|
||
|
||
return {
|
||
app
|
||
}
|
||
}
|