|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="hc-echarts-box">
|
|
|
- <div ref="echart" class="hc-echarts" :style="`width : ${chart?.clientWidth}px`"/>
|
|
|
+ <div :id="isKeyName + '_echart'" ref="echart" class="hc-echarts" :style="`width : ${chart?.clientWidth}px`"/>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -12,14 +12,26 @@ const props = defineProps({
|
|
|
option: {
|
|
|
type: Object,
|
|
|
default: () => ({})
|
|
|
- }
|
|
|
+ },
|
|
|
+ keyname: {
|
|
|
+ type: [Number, String],
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
})
|
|
|
|
|
|
//初始变量
|
|
|
let chart = null;
|
|
|
const echart = ref(null)
|
|
|
+const isKeyName = ref(props.keyname)
|
|
|
const options = ref(getObjValue(props.option))
|
|
|
|
|
|
+//监听
|
|
|
+watch(() => [
|
|
|
+ props.keyname,
|
|
|
+], ([keyname]) => {
|
|
|
+ isKeyName.value = keyname
|
|
|
+})
|
|
|
+
|
|
|
//深度监听
|
|
|
watch(() => [
|
|
|
props.option
|