瀏覽代碼

报错优化

zhengnaiwen_citu 2 周之前
父節點
當前提交
7e2dfc1beb
共有 2 個文件被更改,包括 6 次插入0 次删除
  1. 3 0
      src/views/dataBook/components/mGraph.vue
  2. 3 0
      src/views/dataBook/components/mGraphList.vue

+ 3 - 0
src/views/dataBook/components/mGraph.vue

@@ -319,6 +319,9 @@ export default {
         })
         this.$nextTick(() => {
           this.$refs.graphRef.setOptions(this.graphOptions, async (graphInstance) => {
+            if (!this.$refs.graphRef.setJsonData) {
+              return
+            }
             this.$refs.graphRef.setJsonData(data, async (_graphInstance) => {
               await _graphInstance.setZoom(75)
               successCallback()

+ 3 - 0
src/views/dataBook/components/mGraphList.vue

@@ -102,6 +102,9 @@ export default {
         }
         this.isEmpty = false
         this.$nextTick(() => {
+          if (!this.$refs.graphRef || !this.$refs.graphRef.setJsonData) {
+            return
+          }
           this.$refs.graphRef.setJsonData(data, async (_graphInstance) => {
             this.loading = false
           })