当前位置: 首页 > 工具软件 > CrossUI > 使用案例 >

CROSSUI桌面工具 分布加载模块(Distributed UI Module) 与 主模块Module 之间数据传输!...

令狐唯
2023-12-01

CROSSUI 基于 NW,如何在模Module 之间(主index.js and module1.js)传输数据?  http://www.crossui.com/Forum/post577.html#p577

   http://www.crossui.com/       http://www.linb.net/            https://github.com/linb/CrossUI

方法1:

  (1)父模块调用子模块时, 记住父对象:

    var ns = this ;
         xui.ComFactory.newCom ( "App.employees" , function (){    //xui.ModuleFactory.newModule  ??
                this .$parent = ns;
                this .show();
                  });
   (2) 子模块调用:
       var ns = this ;
       ns.$parent.ctl_input1. setValue (123);
 
   注意:计量 $parent  不使用使用在 '_on_ready'  事件函数,但可用在 '_on_render'。

 

方法2: 

    (1) 在应用(主模块)设置全局计量 (global variable)在 on_ready 事件函数中:

            _on_ready:function() {

        window.$ns =  this ;
      }

    (2) 其它模块从任何地方都可调用:

      window.$ns.ctl_input1.setValue(123);

 

转载于:https://www.cnblogs.com/hopesun/p/6628893.html

 类似资料: