49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
import Vue from 'vue'
|
||
//import App from './App.vue'
|
||
// import App from './AppV2.vue'
|
||
//import App from './AppV3.vue'
|
||
|
||
//永盛等 简单可配置的版本
|
||
import App from './AppCommon.vue'
|
||
|
||
|
||
import ElementUI from 'element-ui'
|
||
import 'element-ui/lib/theme-chalk/index.css'
|
||
|
||
import './assets/common.less'
|
||
|
||
import dataV from '@jiaminghi/data-view'
|
||
import scroll from 'vue-seamless-scroll'
|
||
import api from './api'
|
||
|
||
Vue.config.productionTip = false
|
||
Vue.prototype.$api = api
|
||
Vue.use(ElementUI)
|
||
function resizeFont() {
|
||
const designWidth = 1920; // 设计稿宽度,例如iPhone 6的宽度
|
||
const maxWidth = 1920; // 最大支持宽度
|
||
const screenWidth = Math.min(window.innerWidth, maxWidth);
|
||
const scale = screenWidth / designWidth;
|
||
document.documentElement.style.fontSize = `${100 * scale}px`;
|
||
}
|
||
// 初始调用
|
||
resizeFont();
|
||
// 监听窗口大小变化
|
||
window.addEventListener('resize', resizeFont);
|
||
let fontSize = function (res) {
|
||
let clientWidth =
|
||
window.innerWidth ||
|
||
document.documentElement.clientWidth ||
|
||
document.body.clientWidth;
|
||
if (!clientWidth) return;
|
||
let fontSize = 100 * (clientWidth / 1920);
|
||
return res * fontSize;
|
||
}
|
||
Vue.prototype.$fontSize = fontSize
|
||
Vue.use(dataV)
|
||
Vue.use(scroll)
|
||
Vue.use(scroll, { componentName: 'scroll-seamless' })
|
||
new Vue({
|
||
render: h => h(App)
|
||
}).$mount('#app')
|