mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-08-06 19:07:25 +08:00
升级Vue3,iView替换ElementPlus
- 删除babel配置、更新依赖与入口初始化 - 全量替换UI组件、样式适配,新增迁移文档与标签/过滤器自动化替换脚本
This commit is contained in:
@@ -1,70 +1,52 @@
|
||||
import Vue from "vue";
|
||||
import App from "./App";
|
||||
import router from "./router";
|
||||
import ViewUI from "view-design";
|
||||
import { createApp } from "vue";
|
||||
import "core-js/stable";
|
||||
import "./assets/styles/theme.less";
|
||||
// import './assets/iconfont/iconfont.css';
|
||||
import * as filters from "./plugins/filters";
|
||||
import App from "./App.vue";
|
||||
import { router } from "./router/index";
|
||||
import store from "@/vuex/store";
|
||||
import { setupElementPlus } from "@/plugins/element";
|
||||
import { setupLegacyMessage } from "@/utils/message";
|
||||
import { registerGlobalComponents } from "@/components/global.js";
|
||||
import * as filters from "./plugins/filters";
|
||||
import storage from "@/plugins/storage";
|
||||
// 全局引入封装组件
|
||||
import {InstallAll} from "@/components/global.js";
|
||||
|
||||
const {aMapSecurityJsCode, title, inputMaxLength} = require("@/config");
|
||||
const { aMapSecurityJsCode, inputMaxLength } = require("@/config");
|
||||
|
||||
const copyViewUi = {...ViewUI}
|
||||
copyViewUi.Input.props.maxlength.default = inputMaxLength // 挂载最大输入值
|
||||
Vue.use(copyViewUi);
|
||||
|
||||
|
||||
Vue.use(InstallAll);
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
Object.keys(filters).forEach((key) => {
|
||||
Vue.filter(key, filters[key]);
|
||||
});
|
||||
|
||||
// 高德安全密钥
|
||||
if (aMapSecurityJsCode) {
|
||||
window._AMapSecurityConfig = {
|
||||
securityJsCode: aMapSecurityJsCode,
|
||||
};
|
||||
}
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
ViewUI.LoadingBar.start();
|
||||
window.document.title = to.meta.title === undefined ? title : to.meta.title;
|
||||
next();
|
||||
});
|
||||
const app = createApp(App);
|
||||
|
||||
router.afterEach((route) => {
|
||||
ViewUI.LoadingBar.finish();
|
||||
});
|
||||
setupElementPlus(app);
|
||||
setupLegacyMessage(app);
|
||||
registerGlobalComponents(app);
|
||||
|
||||
Vue.prototype.linkTo = function (url) {
|
||||
app.use(router);
|
||||
app.use(store);
|
||||
|
||||
app.config.globalProperties.$filters = filters;
|
||||
app.config.globalProperties.Cookies = storage;
|
||||
app.config.globalProperties.$inputMaxLength = inputMaxLength;
|
||||
|
||||
app.config.globalProperties.linkTo = function (url) {
|
||||
if (url.substr(0, 1) === "/") {
|
||||
// 非外部链接,没有origin,只有路由地址
|
||||
if (router.mode === "hash") {
|
||||
window.open(location.origin + "/#" + url, "_blank");
|
||||
} else {
|
||||
window.open(location.origin + url, "_blank");
|
||||
}
|
||||
window.open(location.origin + url, "_blank");
|
||||
} else {
|
||||
// 外部链接,完整的url地址
|
||||
window.open(url, "_blank");
|
||||
}
|
||||
};
|
||||
// 联系客服
|
||||
Vue.prototype.connectCs = function (
|
||||
|
||||
app.config.globalProperties.connectCs = function (
|
||||
sign = "37ef9b97807d03c6741298ed4eb5b536d2d238e08a3c00fb01fe48f03a569974c99ad767e72c04b3165ef29aca2c488b505fe4ca"
|
||||
) {
|
||||
const url = "https://yzf.qq.com/xv/web/static/chat/index.html?sign=" + sign;
|
||||
const url =
|
||||
"https://yzf.qq.com/xv/web/static/chat/index.html?sign=" + sign;
|
||||
window.open(url, "_blank");
|
||||
};
|
||||
Vue.prototype.Cookies = storage;
|
||||
/* eslint-disable no-new */
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
render: (h) => h(App),
|
||||
}).$mount("#app");
|
||||
|
||||
router.isReady().then(() => {
|
||||
app.mount("#app");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user