// The Vue build version to load with the `import` command // (runtime-only or standalone) has been set in webpack.base.conf with an alias. import Vue from 'vue' import App from './App' import router from './router' import ElementUI from 'element-ui'; import 'element-ui/lib/theme-chalk/index.css'; import VueAwesomeSwiper from 'vue-awesome-swiper' import Vant from 'vant'; import 'vant/lib/index.css'; import { isMobile } from "@/util" Vue.use(Vant); Vue.use(ElementUI); Vue.config.productionTip = false /* eslint-disable no-new */ new Vue({ el: '#app', router, components: { App }, template: '' }) router.afterEach((to, from, next) => { window.scrollTo(0, 0) }) if (isMobile()) { console.log('H5调用') const setHtmlFontSize = () => { const htmlDom = document.getElementsByTagName('html')[0]; let htmlWidth = document.documentElement.clientWidth || document.body.clientWidth; if (htmlWidth >= 750) { htmlWidth = 750; } if (htmlWidth <= 320) { htmlWidth = 320; } htmlDom.style.fontSize = `${htmlWidth / 7.5}px`; }; window.onresize = setHtmlFontSize; setHtmlFontSize(); } const originalPush = router.prototype.push; router.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => err) }