瀏覽代碼

yvan-ext-mobile 修复 viewModel 不生效问题
修复 子页面显示偶尔父页面页面组件问题
优化进入子页面,返回主页面动画

lizw 3 年之前
父節點
當前提交
c94d709ed8
共有 1 個文件被更改,包括 13 次插入11 次删除
  1. 13 11
      src/Scope.ts

+ 13 - 11
src/Scope.ts

@@ -126,8 +126,8 @@ export class Scope {
             that.vjson,
             {
                 xtype: 'panel',
-                showAnimation: 'slide',
-                hideAnimation: 'slideOut',
+                // showAnimation: 'slide',
+                // hideAnimation: 'slideOut',
             }
         )
 
@@ -140,7 +140,6 @@ export class Scope {
                 ],
             }, config)
         }
-
         that._handle = Ext.create(config)
 
         this.viewModel = that._handle.getViewModel()
@@ -163,6 +162,7 @@ export class Scope {
                         .find('.navbar>.x-panelheader')
                         .find('.x-body-el>.fa-angle-left')
                     $back.on('click', () => {
+                        Ext.Viewport.getLayout().setAnimation({type: 'slide', direction: 'right', duration: 300})
                         that._handle.close()
                     })
                 }
@@ -171,16 +171,18 @@ export class Scope {
                 // 卸载
                 window['cp'] = Ext.Viewport.items.getAt(Ext.Viewport.items.items.length - 2).getViewModel().yvanScope
                 that._onDestroy()
-            }
+            },
         })
-
         Ext.Viewport.add(that._handle)
-
-        // that._handle = Ext.Viewport.add(config)
-        if (allowBack) {
-            that._handle.show();
-        }
-
+        that._handle.setStyle({'z-index': 1})
+        let actived = false;
+        (Ext.Viewport.getItems().items as []).forEach((item, idx) => {
+            if (!actived && item === that._handle) {
+                actived = true
+                Ext.Viewport.getLayout().setAnimation({type: 'slide', direction: 'left', duration: 300})
+                Ext.Viewport.setActiveItem(idx)
+            }
+        })
         return that._handle
     }