mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-08-06 10:57:26 +08:00
升级Vue3,iView替换ElementPlus
- 删除babel配置、更新依赖与入口初始化 - 全量替换UI组件、样式适配,新增迁移文档与标签/过滤器自动化替换脚本
This commit is contained in:
137
im/src/main.js
137
im/src/main.js
@@ -1,82 +1,65 @@
|
||||
import 'core-js/stable'
|
||||
import 'regenerator-runtime/runtime'
|
||||
import "core-js/stable";
|
||||
|
||||
// 引入 Vue 和应用程序组件
|
||||
import Vue from 'vue'
|
||||
import App from '@/App'
|
||||
|
||||
// 引入 store 和 router
|
||||
import store from '@/store'
|
||||
import router from '@/router'
|
||||
|
||||
// 引入自定义的 mixin
|
||||
import MainMixin from './mixins/main-mixin'
|
||||
|
||||
// 引入全局组件
|
||||
import face from '@/components/face'
|
||||
import faceNull from '@/components/face-null'
|
||||
|
||||
// 引入配置文件和其他核心模块
|
||||
import { createApp } from "vue";
|
||||
import App from "@/App.vue";
|
||||
import store from "@/store";
|
||||
import router from "@/router";
|
||||
import MainMixin from "./mixins/main-mixin";
|
||||
import face from "@/components/face";
|
||||
import faceNull from "@/components/face-null";
|
||||
import config from "@/config/config";
|
||||
import './core/lazy-use'
|
||||
import './core/global-component'
|
||||
import './core/filter'
|
||||
import './core/directives'
|
||||
|
||||
// 引入权限控制和图标库
|
||||
import '@/permission'
|
||||
import '@/icons'
|
||||
|
||||
// 引入自定义过滤器,并注册为全局过滤器
|
||||
import { setupElementPlus } from "@/plugins/element";
|
||||
import { setupLegacyMessage } from "@/utils/message";
|
||||
import { registerDirectives } from "./core/directives";
|
||||
import { registerGlobalComponents } from "./core/global-component";
|
||||
import { registerIcons } from "@/icons";
|
||||
import * as filters from "./plugins/filters";
|
||||
Object.keys(filters).forEach((key) => {
|
||||
Vue.filter(key, filters[key]);
|
||||
|
||||
import VueVirtualScroller from "vue-virtual-scroller";
|
||||
import "vue-virtual-scroller/dist/vue-virtual-scroller.css";
|
||||
|
||||
import { setupContextmenu } from "@/plugins/contextmenu";
|
||||
import "@/permission";
|
||||
import "@/assets/css/global.less";
|
||||
|
||||
const app = createApp(App);
|
||||
|
||||
setupElementPlus(app);
|
||||
setupLegacyMessage(app);
|
||||
registerDirectives(app);
|
||||
registerGlobalComponents(app);
|
||||
registerIcons(app);
|
||||
|
||||
app.use(store);
|
||||
app.use(router);
|
||||
setupContextmenu(app);
|
||||
app.use(VueVirtualScroller);
|
||||
app.mixin(MainMixin);
|
||||
|
||||
app.component("face", face);
|
||||
app.component("face-null", faceNull);
|
||||
app.component("RecycleScroller", VueVirtualScroller.RecycleScroller);
|
||||
|
||||
app.config.globalProperties.$filters = filters;
|
||||
app.config.globalProperties.linkToGoods = function (goodsId, skuId) {
|
||||
window.open(
|
||||
`${config.PC_URL}goodsDetail?skuId=${skuId}&goodsId=${goodsId}`,
|
||||
"_blank"
|
||||
);
|
||||
};
|
||||
app.config.globalProperties.linkToStore = function (storeId) {
|
||||
window.open(`${config.PC_URL}/Merchant?id=${storeId}`, "_blank");
|
||||
};
|
||||
app.config.globalProperties.linkToOrders = function (sn) {
|
||||
if (localStorage.getItem("storeFlag") == "false") {
|
||||
window.open(`${config.PC_STORE}order-detail?sn=${sn}`, "_blank");
|
||||
} else {
|
||||
window.open(`${config.PC_URL}home/OrderDetail?sn=${sn}`, "_blank");
|
||||
}
|
||||
};
|
||||
|
||||
router.isReady().then(() => {
|
||||
app.mount("#app");
|
||||
});
|
||||
|
||||
|
||||
import VueVirtualScroller from 'vue-virtual-scroller'
|
||||
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
|
||||
Vue.component('RecycleScroller', VueVirtualScroller.RecycleScroller)
|
||||
|
||||
// 引入自定义全局css
|
||||
import '@/assets/css/global.less'
|
||||
|
||||
// 关闭生产提示
|
||||
Vue.config.productionTip = false
|
||||
|
||||
// 注册全局 mixin
|
||||
Vue.mixin(MainMixin)
|
||||
Vue.component('face', face)
|
||||
Vue.component('face-null', faceNull)
|
||||
|
||||
|
||||
// 添加自定义原型方法
|
||||
Vue.prototype.linkToGoods = function (goodsId, skuId) { // 跳转买家端商品
|
||||
if (localStorage.getItem('storeFlag') == 'false') {
|
||||
window.open(`${config.PC_URL}goodsDetail?skuId=${skuId}&goodsId=${goodsId}`, '_blank')
|
||||
} else {
|
||||
window.open(`${config.PC_URL}goodsDetail?skuId=${skuId}&goodsId=${goodsId}`, '_blank')
|
||||
}
|
||||
};
|
||||
Vue.prototype.linkToStore = function (storeId) { // 跳转商家端商品
|
||||
console.log(`${config.PC_URL}/Merchant?id=${storeId}`)
|
||||
window.open(`${config.PC_URL}/Merchant?id=${storeId}`, '_blank')
|
||||
};
|
||||
// 订单跳转商家订单页面
|
||||
Vue.prototype.linkToOrders = function (sn) {
|
||||
if (localStorage.getItem('storeFlag') == 'false') {
|
||||
// 商家
|
||||
window.open(`${config.PC_STORE}order-detail?sn=${sn}`, '_blank')
|
||||
} else {
|
||||
// 用户
|
||||
window.open(`${config.PC_URL}home/OrderDetail?sn=${sn}`, '_blank')
|
||||
}
|
||||
};
|
||||
|
||||
const Instance = new Vue({
|
||||
router,
|
||||
store,
|
||||
mixins: [MainMixin],
|
||||
render: h => h(App),
|
||||
}).$mount('#app')
|
||||
export default Instance
|
||||
export default app;
|
||||
|
||||
Reference in New Issue
Block a user