Commit 7a06d7a4 authored by liushuai's avatar liushuai

修复定制化图表显示问题

parent 78177e11
<template> <template>
<div class="setting"> <div class="setting">
<div name="dataZoom" class="dataZoom"> <div name="dataZoom" class="dataZoom">
<div slot="title" class="collapse-item"> <div slot="title" class="collapse-item" @click="change">
数据区域缩放 数据区域缩放
<el-switch <el-switch ref="switch" style="pointer-events: none;"
v-model="show" v-model="show"
@change="changeShow"
active-color="#13ce66"> active-color="#13ce66">
</el-switch> </el-switch>
...@@ -33,7 +31,22 @@ ...@@ -33,7 +31,22 @@
mounted() { mounted() {
this.activeNames=["dataZoom"] this.activeNames=["dataZoom"]
}, },
watch:{
"show":function (newval,oldVal) {
for(var i in this.chartSettingsDataZoom){
let item = this.chartSettingsDataZoom[i]
item.show = newval
}
this.$store.commit('charts/updateChartSettingsDataZoom', this.chartSettingsDataZoom);
},
},
methods:{ methods:{
change(){
// 获取 el-switch 的实例
const elSwitch = this.$refs.switch;
// 手动触发 el-switch 的点击事件
elSwitch.$el.click();
},
changeShow(value){ changeShow(value){
for(var i in this.chartSettingsDataZoom){ for(var i in this.chartSettingsDataZoom){
let item = this.chartSettingsDataZoom[i] let item = this.chartSettingsDataZoom[i]
...@@ -50,6 +63,7 @@ ...@@ -50,6 +63,7 @@
flex: 1; flex: 1;
} }
.collapse-item{ .collapse-item{
cursor: pointer;
/*width: 100%;*/ /*width: 100%;*/
font-weight: bold; font-weight: bold;
line-height: 40px; line-height: 40px;
......
...@@ -44,6 +44,16 @@ ...@@ -44,6 +44,16 @@
computed: { computed: {
...mapState('charts',['chartSettingsSeries']) ...mapState('charts',['chartSettingsSeries'])
}, },
watch:{
'activeNames':function (newVal,oldVal) {
if(this.activeNames.length>0){
this.chartSettingsSeries.showPoint=true
}else {
this.chartSettingsSeries.showPoint=false
}
this.$store.commit('charts/updateChartSettingsSeries', this.chartSettingsSeries);
}
},
mounted() { mounted() {
if(this.show==true){ if(this.show==true){
this.activeNames=["point"] this.activeNames=["point"]
......
...@@ -251,11 +251,12 @@ ...@@ -251,11 +251,12 @@
}, },
watch:{ watch:{
'activeNames':function (newVal,oldVal) { 'activeNames':function (newVal,oldVal) {
if(newVal.length>0){ if(this.activeNames.length>0){
this.chartSettingsYAxis.show = true this.chartSettingsYAxis.show = true
}else { }else {
this.chartSettingsYAxis.show = false this.chartSettingsYAxis.show = false
} }
// console.log( this.chartSettingsYAxis.show )
this.$store.commit('charts/updateChartSettingYAxis', this.chartSettingsYAxis); this.$store.commit('charts/updateChartSettingYAxis', this.chartSettingsYAxis);
}, },
'axisShow':function (newVal,oldVal) { 'axisShow':function (newVal,oldVal) {
......
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