Commit a96cb0dd authored by Jenny's avatar Jenny

feat: 图表组件点击交互

parent 10d99f0e
const install = (Vue, vm) => {
Vue.prototype.$u.http.setConfig({
baseUrl: 'https://api.charleskeith.cn', // 请求的本域名
// baseUrl: 'http://192.168.138.55:808l',
// baseUrl: 'https://api.charleskeith.cn', // 请求的本域名
baseUrl: 'http://192.168.138.55:8081',
showLoading: true, // 是否显示请求中的loading
loadingText: '努力加载中。。。', // 请求loading中的文字提示
loadingTime: 300, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
......
......@@ -46,6 +46,9 @@
const { mapMixBarShow, mapMixBarChangeInterval} = this.elementInfo.option.mapMix
let flag = true
chart.setOption(options, true)
chart.on('click', event => {
this.handleEchartsClick(event)
})
// 柱状图 地图 切换
if(mapMixBarShow && mapMixBarChangeInterval) {
clearInterval(this.changeTimer)
......
......@@ -137,6 +137,9 @@
series: series
}
chart.setOption(options)
chart.on('click', event => {
this.handleEchartsClick(event)
})
return chart
})
})
......
......@@ -53,6 +53,9 @@ export default {
series: this.dealSeriesData(series)
}
chart.setOption(options)
chart.on('click', event => {
this.handleEchartsClick(event)
})
return chart
})
})
......
......@@ -67,6 +67,9 @@
series: this.dealSeriesData(series)
}
chart.setOption(options)
chart.on('click', event => {
this.handleEchartsClick(event)
})
return chart
})
})
......
......@@ -53,6 +53,9 @@ export default {
series: this.dealSeriesData(series)
}
chart.setOption(options)
chart.on('click', event => {
this.handleEchartsClick(event)
})
return chart
})
})
......
......@@ -53,6 +53,9 @@ export default {
series: this.dealSeriesData(series)
}
chart.setOption(options)
chart.on('click', event => {
this.handleEchartsClick(event)
})
return chart
})
})
......
......@@ -57,6 +57,9 @@ export default {
series: this.dealSeriesData(series)
}
chart.setOption(options)
chart.on('click', event => {
this.handleEchartsClick(event)
})
return chart
})
})
......
......@@ -64,10 +64,17 @@ export default {
this.$u.toast(Msg)
}
},
clearTimer() {
clearInterval(this.timer)
this.timer = null
}
clearTimer() {
clearInterval(this.timer)
this.timer = null
},
/**
* 组件点击交互 - 传参
*/
handleEchartsClick (chartEvent ) {
const { index, paramName } = this.elementInfo.child
uni.$emit('handleLinkParams', { index, paramName, value: chartEvent.name })
}
},
deactivated() {
this.clearTimer()
......
......@@ -75,6 +75,7 @@
onUnload() {
// 移除监听事件
uni.$off('handleLinkParams')
clearInterval(this.timer)
},
methods: {
//检查是否登录
......
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