62 lines
2.0 KiB
JavaScript
62 lines
2.0 KiB
JavaScript
import Vue from 'vue';
|
|
import App from './App.vue';
|
|
import router from './router';
|
|
import ElementUI from 'element-ui'
|
|
import 'element-ui/lib/theme-chalk/index.css'
|
|
import store from './store';
|
|
import dataV from '@jiaminghi/data-view';
|
|
// 引入全局css
|
|
import './assets/scss/style.scss';
|
|
// 按需引入vue-awesome图标
|
|
import Icon from 'vue-awesome/components/Icon';
|
|
import 'vue-awesome/icons/chart-bar.js';
|
|
import 'vue-awesome/icons/chart-area.js';
|
|
import 'vue-awesome/icons/chart-pie.js';
|
|
import 'vue-awesome/icons/chart-line.js';
|
|
import 'vue-awesome/icons/align-left.js';
|
|
|
|
//引入echart
|
|
//4.x 引用方式
|
|
import echarts from 'echarts'
|
|
import 'echarts-liquidfill'
|
|
//5.x 引用方式为按需引用
|
|
//希望使用5.x版本的话,需要在package.json中更新版本号,并切换引用方式
|
|
//import * as echarts from 'echarts'
|
|
Vue.prototype.$echarts = echarts
|
|
Vue.config.productionTip = false;
|
|
Vue.use(ElementUI)
|
|
// 全局注册
|
|
Vue.component('icon', Icon);
|
|
Vue.use(dataV);
|
|
|
|
router.beforeEach((to, from, next) => {
|
|
// 根据路由元信息设置文档标题
|
|
window.document.title = to.meta.title
|
|
next()
|
|
})
|
|
function receiveMessageFromIframePage(event) {
|
|
console.log(event.data, event)
|
|
console.log(event.data.params, 'event.data.params')
|
|
console.log(event.data.url, 'event.data.url')
|
|
if (event.data.data.includes('办公用地')) {
|
|
var id = event.data.params
|
|
var url = event.data.url
|
|
// router.push({name: 'landChild',params:{id}})
|
|
router.push({ name: 'landChild', params: { id, url } })
|
|
} else if (event.data.data.includes('noparams')) {
|
|
router.push({ name: 'landChild' })
|
|
}
|
|
if (event.data.data.includes('建筑工地')) {
|
|
var params = event.data.data
|
|
var wisUrl = event.data.url
|
|
router.push({ name: 'wisdomChild', params: { params, wisUrl } })
|
|
} else if (event.data.data.includes('noparams')) {
|
|
router.push({ name: 'wisdomChild' })
|
|
}
|
|
}
|
|
window.addEventListener("message", receiveMessageFromIframePage, false);
|
|
new Vue({
|
|
router,
|
|
store,
|
|
render: (h) => h(App),
|
|
}).$mount('#app'); |