44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
import App from '@/App'
|
|
import * as Pinia from 'pinia'
|
|
import globalFunction from '@/common/globalFunction'
|
|
import '@/lib/string-similarity.min.js'
|
|
import similarityJobs from '@/utils/similarity_Job.js';
|
|
import NoBouncePage from '@/components/NoBouncePage/NoBouncePage.vue'
|
|
import MsgTips from '@/components/MsgTips/MsgTips.vue'
|
|
// import Tabbar from '@/components/tabbar/midell-box.vue'
|
|
// 自动导入 directives 目录下所有指令
|
|
const directives = import.meta.glob('./directives/*.js', {
|
|
eager: true
|
|
});
|
|
|
|
import {
|
|
createSSRApp,
|
|
} from 'vue'
|
|
|
|
// 全局组件
|
|
export function createApp() {
|
|
const app = createSSRApp(App)
|
|
|
|
app.component('NoBouncePage', NoBouncePage)
|
|
app.component('MsgTips', MsgTips)
|
|
// app.component('tabbar-custom', Tabbar)
|
|
|
|
for (const path in directives) {
|
|
const directiveModule = directives[path];
|
|
// 文件名作为指令名,./directives/fade.js => v-fade
|
|
const name = path.match(/\.\/directives\/(.*)\.js$/)[1];
|
|
app.directive(name, directiveModule.default);
|
|
}
|
|
|
|
app.provide('globalFunction', {
|
|
...globalFunction,
|
|
similarityJobs
|
|
});
|
|
app.provide('deviceInfo', globalFunction.getdeviceInfo());
|
|
|
|
app.use(Pinia.createPinia());
|
|
return {
|
|
app,
|
|
Pinia
|
|
}
|
|
} |