删除普后,在次加载普的时候,上次数据没有清空的问题

This commit is contained in:
任珮宇 2024-01-19 10:01:19 +08:00
parent bd7dcfa030
commit 900abc7adc

View File

@ -11,7 +11,7 @@
</span>
</div>
<div class="beta-gamma-spectrum-chart-main">
<CustomChart key="1" ref="roiLimitsRef" :option="roiLimitsOption" />
<CustomChart :key="chartKey" ref="roiLimitsRef" :opts="opts" :option="roiLimitsOption" />
</div>
</div>
</template>
@ -106,36 +106,33 @@ export default {
watch: {
ROILists: {
handler(newVal) {
// this.active = 0
// this.$emit('sendIndex', 0)
// const [ROIOneList, ...lists] = newVal
this.buildOneLineList(newVal[this.active])
},
// immediate: true,
immediate: true,
},
},
beforeDestroy() {
const myChart = this.$refs.roiLimitsRef.getChartInstance()
myChart.dispose()
},
data() {
this.buttons = buttons
return {
active: 0,
roiLimitsOption,
opts: {
notMerge: true,
},
chartKey: 'limit',
}
},
mounted() {
// this.$bus.$on('updateRoi', this.updateRoi)
},
destroyed() {
// this.$bus.$off('updateRoi', this.updateRoi)
},
methods: {
// updateRoi(data) {
// this.buildOneLineList(data)
// this.active = 0
// },
buildOneLineList(val) {
const currSeries = this.roiLimitsOption.series
if (val) {
const currSeries = this.roiLimitsOption.series
currSeries.data = val.map((item) => [item.x, item.y])
} else {
currSeries.data = []
}
},
// Beta-Gamma Spectrum: Sample