Commit a96cb0dd authored by Jenny's avatar Jenny

feat: 图表组件点击交互

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