You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.7 KiB

import Vue from 'vue'
import App from './App'
import {
router,
RouterMount
} from './router.js' //路径换成自己的
Vue.use(router)
import config from '@/components/hzjc/config.js'
import request from '@/components/hzjc/utils/request.js'
import common from '@/components/hzjc/utils/common.js'
import image from '@/components/hzjc/utils/functions/image.js'
import websocket from '@/components/hzjc/utils/websocket.js'
Vue.config.productionTip = false
Vue.prototype.rq = request
Vue.prototype.cn = common
Vue.prototype.websocket = websocket
Vue.prototype.image = image
App.mpType = 'app'
// #ifdef H5
import vconsole from 'vconsole'
if (config.vconsole_debug) {
Vue.prototype.vc = new vconsole()
}
import jweixin from "components/hzjc/utils/auth/wxjssdk.js"
if (common.userAgent() == 'weixin') { //微信环境引进wx-jssdk
Vue.prototype.wx = jweixin
}
// #endif
//定义全局方法 页面跳转 type--跳转方式
Vue.prototype.go = (url, type = 1) => {
//http跳转url /pages跳转内部页面
let str = ''
if (url.length >= 4) {
str = url.substring(0, 4)
}
if (str == 'http') {
uni.setStorageSync('webview_url', url)
uni.navigateTo({
url: '/pages/common/webview'
})
} else {
if (type == 1) {
uni.navigateTo({
url: url
})
} else if (type == 2) {
uni.redirectTo({
url: url
})
} else if (type == 3) {
uni.switchTab({
url: url
})
} else if (type == 4) {
uni.navigateBack({
delta: url
})
}
}
}
const app = new Vue({
...App
})
//v1.3.5起 H5端 你应该去除原有的app.$mount();使用路由自带的渲染方式
// #ifdef H5
RouterMount(app, router, '#app')
// #endif
// #ifndef H5
app.$mount(); //为了兼容小程序及app端必须这样写才有效果
// #endif