Files
ebiz-h5/src/main.js
zhu.wenli@ebiz-digits.com 41a9dd5843 机构业绩页面
2020-07-30 21:12:47 +08:00

121 lines
2.8 KiB
JavaScript

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Filters from '@/filters'
import FastClick from 'fastclick'
import '@/assets/js/utils/validator' //表单校验
import Jump from '@/assets/js/utils/jump'
import utils from '@/assets/js/business-common'
import config from '@/config'
import noMoreClick from '@/directive/noMoreClick'
import vueHashCalendar from 'vue-hash-calendar'
import 'vue-hash-calendar/lib/vue-hash-calendar.css'
import {
Cell, CellGroup,
DatetimePicker ,
Popup ,
Picker,
Col,
Row,
Tab,
Tabs,
NavBar,
Toast,
Button,
Dialog,
Icon,
Lazyload
} from 'vant'
Vue.use(Cell);
Vue.use(CellGroup)
Vue.use(DatetimePicker);
Vue.use(Popup)
Vue.use(Picker)
Vue.use(Col)
Vue.use(Row);
Vue.use(Tab)
Vue.use(Tabs);
Vue.use(Icon)
Vue.use(vueHashCalendar)
Vue.use(NavBar);
Vue.use(Toast)
Vue.use(Button)
Vue.use(Dialog)
Vue.use(Lazyload, {
lazyComponent: true,
});
Vue.prototype.$assetsUrl = config.assetsUrl
Vue.prototype.$mainUrl = config.mainUrl
Vue.prototype.$zssqUrl = config.zssqUrl
// 全局 防重复点击
Vue.directive('no-more-click', noMoreClick)
//解决ios移动端input调软键盘问题
let isIphone = navigator.userAgent.indexOf('iPhone') != -1
if (isIphone) {
FastClick.prototype.focus = function (targetElement) {
let length
if (
isIphone &&
targetElement.setSelectionRange &&
targetElement.type.indexOf('date') !== 0 &&
targetElement.type !== 'time' &&
targetElement.type !== 'month' &&
targetElement.type !== 'email'
) {
length = targetElement.value.length
targetElement.setSelectionRange(length, length)
/*修复bug ios 11.3不弹出键盘,这里加上聚焦代码,让其强制聚焦弹出键盘*/
targetElement.focus()
} else {
targetElement.focus()
}
}
}
//router or bridge jump
Vue.prototype.$jump = Jump
Vue.prototype.$utils = utils
//混合开发调试工具
// if (process.env.NODE_ENV == 'development') {
// // let Eruda = require('eruda')
// // Eruda.init()
// Vue.prototype.$rootUrl = location.origin
// } else if (process.env.NODE_ENV == 'production') {
// Vue.prototype.$rootUrl = location.origin + '/ebiz-h5'
// }
if (process.env.VUE_APP_FLAG != 'prd') {
let Eruda = require('eruda')
Eruda.init()
} else {
// Vue.prototype.$rootUrl = location.origin + '/ebiz-h5'
Vue.config.devtools = true
}
// let Eruda = require('eruda')
// Eruda.init()
// 注册过滤器
Object.keys(Filters).forEach(function (k) {
Vue.filter(k, Filters[k])
})
//权限控制
import {
permission
} from '@/assets/js/utils/permission'
permission()
//ios点击300毫秒时延
FastClick.attach(document.body)
Vue.config.productionTip = false
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')