yuliang 3 年 前
コミット
0ff4c1582a
3 ファイル変更17 行追加7 行削除
  1. 5 3
      src/controls/grid.js
  2. 9 4
      src/init.ts
  3. 3 0
      src/lib/lib.ts

+ 5 - 3
src/controls/grid.js

@@ -20,7 +20,7 @@ export default function () {
             }, baseConfig(config, 'row-item'), config, grid)
 
 
-            if (_.isPlainObject(dataSource) && dataSource.method === 'invoke') {
+            if (_.isPlainObject(dataSource) && dataSource.method === 'invoke' && !window["IS_DESIGN_MODE"]) {
                 newConfig.store = {
                     autoLoad: newConfig.autoLoad,
                     remoteSort: newConfig.remoteSort,
@@ -152,8 +152,10 @@ export default function () {
             const {config} = me
             const scope = lookupScope(this)
 
-            // 转换 dataSource 属性
-            convertDataSource(me, scope, config)
+            if (!window["IS_DESIGN_MODE"]) {
+                // 转换 dataSource 属性
+                convertDataSource(me, scope, config)
+            }
 
             this.on({
                 afterrender(sender) {

+ 9 - 4
src/init.ts

@@ -63,10 +63,15 @@ export function init() {
     Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
         if (typeof fn === 'string' && _.startsWith(fn, 'scope.')) {
             // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
-            const vm = this.lookupViewModel()
-            if (vm && vm.yvanScope) {
-                scope = vm.yvanScope
-                fn = scope[fn.substr('scope.'.length)]
+            if (window["IS_DESIGN_MODE"]) {
+                fn = Ext.emptyFn
+
+            }else {
+                const vm = this.lookupViewModel()
+                if (vm && vm.yvanScope) {
+                    scope = vm.yvanScope
+                    fn = scope[fn.substr('scope.'.length)]
+                }
             }
         }
 

+ 3 - 0
src/lib/lib.ts

@@ -30,6 +30,9 @@ export function Lib(registe: FunctionRegiste) {
  *   'format.格式化名'
  */
 export function lookupFn(scope: Scope, event: string): Function {
+    if (window["IS_DESIGN_MODE"]) {
+        return Ext.emptyFn
+    }
     // 为 eval 准备环境
     const func: Function = eval(event)