Quellcode durchsuchen

表单的图表

ZaiZai vor 1 Jahr
Ursprung
Commit
2939433787
1 geänderte Dateien mit 14 neuen und 2 gelöschten Zeilen
  1. 14 2
      src/components/plugins/table-form/echart.vue

+ 14 - 2
src/components/plugins/table-form/echart.vue

@@ -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