init
This commit is contained in:
61
main.js
Normal file
61
main.js
Normal file
@@ -0,0 +1,61 @@
|
||||
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 AppLayout from './components/AppLayout/AppLayout.vue';
|
||||
import Empty from './components/empty/empty.vue';
|
||||
import NoBouncePage from '@/components/NoBouncePage/NoBouncePage.vue'
|
||||
import MsgTips from '@/components/MsgTips/MsgTips.vue'
|
||||
import SelectPopup from '@/components/selectPopup/selectPopup.vue'
|
||||
import SelectPopupPlugin from '@/components/selectPopup/selectPopupPlugin';
|
||||
import RenderJobs from '@/components/renderJobs/renderJobs.vue';
|
||||
import RenderCompanys from '@/components/renderCompanys/renderCompanys.vue';
|
||||
// import Tabbar from '@/components/tabbar/midell-box.vue'
|
||||
// 自动导入 directives 目录下所有指令
|
||||
const directives = import.meta.glob('./directives/*.js', {
|
||||
eager: true
|
||||
});
|
||||
|
||||
import {
|
||||
createSSRApp,
|
||||
} from 'vue'
|
||||
|
||||
const foldFeature = window.visualViewport && 'segments' in window.visualViewport
|
||||
console.log('是否支持多段屏幕:', foldFeature)
|
||||
|
||||
// 全局组件
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
|
||||
app.component('AppLayout', AppLayout)
|
||||
app.component('Empty', Empty)
|
||||
app.component('NoBouncePage', NoBouncePage)
|
||||
app.component('MsgTips', MsgTips)
|
||||
app.component('SelectPopup', SelectPopup)
|
||||
app.component('RenderJobs', RenderJobs)
|
||||
app.component('RenderCompanys', RenderCompanys)
|
||||
// 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(SelectPopupPlugin);
|
||||
app.use(Pinia.createPinia());
|
||||
|
||||
return {
|
||||
app,
|
||||
Pinia
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user