lilishop-ui/buyer/src/main.js

66 lines
1.7 KiB
JavaScript
Raw Normal View History

import Vue from "vue";
import App from "./App";
import router from "./router";
import ViewUI from "view-design";
import "./assets/styles/theme.less";
// import './assets/iconfont/iconfont.css';
import * as filters from "./plugins/filters";
import store from "@/vuex/store";
import storage from "@/plugins/storage";
2021-05-13 10:56:04 +08:00
// 全局引入封装组件
import { InstallAll } from "@/components/global.js";
2021-05-13 10:56:04 +08:00
const { aMapSecurityJsCode, title } = require("@/config");
2021-05-13 10:56:04 +08:00
Vue.use(ViewUI);
Vue.use(InstallAll);
Vue.config.productionTip = false;
Object.keys(filters).forEach((key) => {
2021-05-13 10:56:04 +08:00
Vue.filter(key, filters[key]);
});
// 高德安全密钥
if (aMapSecurityJsCode) {
window._AMapSecurityConfig = {
securityJsCode: aMapSecurityJsCode,
};
}
2021-05-13 10:56:04 +08:00
router.beforeEach((to, from, next) => {
ViewUI.LoadingBar.start();
window.document.title = to.meta.title === undefined ? title : to.meta.title;
2021-05-13 10:56:04 +08:00
next();
});
router.afterEach((route) => {
2021-05-13 10:56:04 +08:00
ViewUI.LoadingBar.finish();
});
Vue.prototype.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");
}
} else {
// 外部链接完整的url地址
window.open(url, "_blank");
2021-05-13 10:56:04 +08:00
}
};
2021-05-31 18:03:48 +08:00
// 联系客服
Vue.prototype.connectCs = function (
sign = "37ef9b97807d03c6741298ed4eb5b536d2d238e08a3c00fb01fe48f03a569974c99ad767e72c04b3165ef29aca2c488b505fe4ca"
) {
const url = "https://yzf.qq.com/xv/web/static/chat/index.html?sign=" + sign;
window.open(url, "_blank");
};
Vue.prototype.Cookies = storage;
2021-05-13 10:56:04 +08:00
/* eslint-disable no-new */
new Vue({
router,
store,
render: (h) => h(App),
}).$mount("#app");