Browse Source

showPage / showDialog / renderTo

luoyifan 4 years ago
parent
commit
ed940a7716
1 changed files with 30 additions and 14 deletions
  1. 30 14
      src/Scope.ts

+ 30 - 14
src/Scope.ts

@@ -48,6 +48,14 @@ export class Scope {
     }
     }
 
 
     /**
     /**
+     * 产生一个当前模块有效的唯一id
+     * @param key 唯一编号
+     */
+    uid(key) {
+        return this.id + key
+    }
+
+    /**
      * 以对话框模式打开当前模块
      * 以对话框模式打开当前模块
      * @param sender 发送者(按钮或Scope对象)
      * @param sender 发送者(按钮或Scope对象)
      * @param vjsonOption 界面覆盖选项(可以为空)
      * @param vjsonOption 界面覆盖选项(可以为空)
@@ -176,6 +184,28 @@ export class Scope {
         this._handle.close()
         this._handle.close()
     }
     }
 
 
+    /**
+     * 获取 viewModel 里包含的数据(只读)
+     */
+    get data() {
+        return this.viewModel.getData()
+    }
+
+    /**
+     * 寻找模块内所有的 xtype 对应的对象
+     * @param xtypeKey
+     */
+    down(xtypeKey) {
+        return this._handle.down(xtypeKey)
+    }
+
+    /**
+     * 获取所有设置过 Reference 名称的组件
+     */
+    get refs() {
+        return this._handle.getReferences()
+    }
+
     constructor({model, vjson}) {
     constructor({model, vjson}) {
         const that = this
         const that = this
         this.model = model
         this.model = model
@@ -245,13 +275,6 @@ export class Scope {
     }
     }
 
 
     /**
     /**
-     * 获取所有设置过 Reference 名称的组件
-     */
-    get refs() {
-        return this._handle.getReferences()
-    }
-
-    /**
      * 模块载入完成之后的回调
      * 模块载入完成之后的回调
      */
      */
     onLoad() {
     onLoad() {
@@ -293,13 +316,6 @@ export class Scope {
     onDestroy() {
     onDestroy() {
     }
     }
 
 
-    /**
-     * 产生一个当前模块有效的唯一id
-     * @param key 唯一编号
-     */
-    uid(key) {
-        return this.id + key
-    }
 }
 }
 
 
 /**
 /**