Commit 5c6d2832 authored by JingChao's avatar JingChao

Update main.js

parent acea6681
// 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 FastClick from 'fastclick'
import App from './App'
import Vuex from 'vuex'
import vuexI18n from 'vuex-i18n'
import router from './router/index'
import flexible from './common/ydui.flexible'
import {componentInstall, appStyle, hlsUtil, get, post, hlsPopup, directives, filter} from '../packages/index'
/**
* 组件
*/
import {
ViewBox,
Tabbar,
TabbarItem,
XHeader,
Picker,
PopupHeader,
} from 'vux'
import './scripts/prototype'
import './scripts/vuePlatform'
/** end**/
if (process.env.CONFIG_ENV === 'uat') {
const VConsole = require('vconsole')
new VConsole() // eslint-disable-line
}
Vue.use(componentInstall)
Vue.use(appStyle)
Vue.use(flexible)
Vue.use(directives)
Vue.use(filter)
Vue.use(Vuex)
// Vue.directive('transfer-dom', TransferDom);
Vue.component('x-header', XHeader)
Vue.component('view-box', ViewBox)
Vue.component('tabbar', Tabbar)
Vue.component('tabbar-item', TabbarItem)
Vue.component('PopupHeader', PopupHeader)
Vue.component('picker', Picker)
/** i18n **/
let store = new Vuex.Store({
modules: {
i18n: vuexI18n.store,
},
})
Vue.use(vuexI18n.plugin, store)
Vue.prototype.hlsPopup = window.hlsPopup = hlsPopup
Vue.prototype.$devicePixelRatio = 2
Vue.prototype.$post = post
Vue.prototype.$get = get
let hlsHttp = {
get: get,
post: post,
}
Vue.prototype.hlsHttp = window.hlsHttp = hlsHttp
Vue.prototype.hlsUtil = window.hlsUtil = hlsUtil
/**
* 全局返回上一页面
* @param index
*/
let routeGo = function (index) {
if (!index) {
index = -1
}
this.$router.go(index)
}
Vue.prototype.$routeGo = routeGo
let hlsExit = function () {
if (vum.Platform.isIOS()) {
cordova.exec(null, null, 'BridgePlugin', 'closeWebView', [])
} else if (vum.Platform.isIOS()) {
var dict = {
'className': 'WebBridge',
'function': 'close',
'successCallBack': 'sCallBack',
'failureCallBack': 'eCallBack',
}
HandBridge.postMessage(JSON.stringify(dict))
}
}
Vue.prototype.$hlsExit = hlsExit
FastClick.attach(document.body)
Vue.config.productionTip = false
vum.$vumPlatform.ready(function () {
if ((vum.Platform.isAndroid()) || (vum.Platform.isIOS())) {
}
})
vum.$vumPlatform.registerBackButtonAction(function (e) {
}, 101)
/* eslint-disable no-new */
new Vue({
data () {
return {
pathList: [],
transitionName: null,
}
},
router,
watch: { // 监听路由变化
$route (to, from) {
document.body.scrollTop = 0
document.documentElement.scrollTop = 0
},
},
render: h => h(App),
}).$mount('#app-box')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment