js文件rem.js(//1rem=100px)
代码
!(function(n) {
var e = n.document,
t = e.documentElement,
i = 1920,
d = i / 100,
o = 'orientationchange' in n ? 'orientationchange' : 'resize',
a = function() {
var n = t.clientWidth || 1920
// n > 1920 && (n = 1920);
t.style.fontSize = n / d + 'px'
}
e.addEventListener && (n.addEventListener(o, a, !1), e.addEventListener('DOMContentLoaded', a, !1))
}(window))
main.js中引入
代码
// 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 install from './common/index'
Vue.use(install);
import '@/utils/rem'
import router from './router'
import store from './vuex'
import 'font-awesome/css/font-awesome.css'
import $ from 'jquery'
import vuex from './vuex'
import App from './App'
Vue.config.productionTip = false
/* eslint-disable no-new */
const vm= new Vue({
el: '#app',
router,
store,
components: { App },
template: '<App/>'
})
export default vm
//其他页面可以用vm指代vue实例this对象