65 lines
1.7 KiB
JavaScript
65 lines
1.7 KiB
JavaScript
import App from './App';
|
|
import {
|
|
createSSRApp,
|
|
getCurrentInstance
|
|
} from 'vue';
|
|
import {
|
|
setupPinia
|
|
} from './sheep/store';
|
|
import * as utils from './utils/index'
|
|
import sheep from '@/sheep';
|
|
import {
|
|
fen2yuan
|
|
} from '@/sheep/hooks/useGoods';
|
|
import {
|
|
debounce
|
|
} from '@/utils/common'
|
|
import { createHotUpdate, createLoadingProgress } from '@/utils/hotUpdate'
|
|
import { gethotupdatelist } from '@/sheep/api/index/index'
|
|
import { setupVConsole } from '@/utils/vconsole.js'
|
|
|
|
|
|
|
|
export function createApp() {
|
|
|
|
setupVConsole();
|
|
|
|
const hotUpdate = createHotUpdate({
|
|
progress: createLoadingProgress(),
|
|
apkMode: 'download',
|
|
getLatest: gethotupdatelist,
|
|
})
|
|
|
|
uni.__globalHotUpdateCheck = (options = {}) => {
|
|
const force = !!options?.force
|
|
if (!force && uni.__hotUpdateCheckedOnce) return
|
|
uni.__hotUpdateCheckedOnce = true
|
|
return hotUpdate.checkUpdate({ allowSkipPrompt: true })
|
|
}
|
|
|
|
const app = createSSRApp(App);
|
|
|
|
app.mixin({
|
|
onShow() {
|
|
if (typeof uni.__globalHotUpdateCheck === 'function') {
|
|
uni.__globalHotUpdateCheck({ force: true, source: 'pageShow' })
|
|
}
|
|
},
|
|
})
|
|
setTimeout(() => {
|
|
if (typeof uni.__globalHotUpdateCheck === 'function') uni.__globalHotUpdateCheck({ source: 'boot' })
|
|
}, 0)
|
|
|
|
setupPinia(app);
|
|
app.config.globalProperties.$url = 'https://sycbuck.oss-cn-hangzhou.aliyuncs.com/app/'
|
|
app.config.globalProperties.$ygUrl = 'https://swzhyg.oss-cn-hangzhou.aliyuncs.com/static/'
|
|
app.config.globalProperties.utils = utils;
|
|
app.config.globalProperties.$sheep = sheep;
|
|
app.config.globalProperties.$fen2yuan = fen2yuan;
|
|
app.config.globalProperties.$debounce = debounce;
|
|
app.config.globalProperties.$proxy = getCurrentInstance();
|
|
return {
|
|
app,
|
|
};
|
|
}
|