Эх сурвалжийг харах

表单渲染类,增加销毁示例方法

ZaiZai 2 жил өмнө
parent
commit
41c531bb66

+ 12 - 0
src/plugins/HTableForm.js

@@ -27,6 +27,9 @@ const components = {
 
 //表单渲染
 export default class HTableForm {
+
+    static tableFormApp = null
+
     static createForm({template, tableForm, keys, appId, onRight, onBlur, onLeftClick}) {
         const _this = this;
         const app = createApp({
@@ -133,6 +136,7 @@ export default class HTableForm {
             }
         })
         app.mount(appId)
+        this.tableFormApp = app
         return app
     }
 
@@ -300,4 +304,12 @@ export default class HTableForm {
         }
     }
 
+    //卸载示例
+    static unmountFormApp() {
+        if (this.tableFormApp) {
+            this.tableFormApp?.unmount()
+            this.tableFormApp = null
+        }
+    }
+
 }