UNPKG

cyra

Version:

single page application view engine

152 lines (126 loc) 4.76 kB
# CHANGELOG ## 2.1.14 (@zee) - 默认动画调优 ## 2.1.12 ~ 2.1.13 (@zee) - iOS 9.0 以下取消动画 ## 2.1.11 (@zee) - 首页取消动画 ## 2.1.10 (@zee) - 安卓取消动画(华为系统均不支持) ## 2.1.7 (@zee) - 支持更多第二种动画 ## 2.1.5 (@zee) - 兼容 Safari 无痕浏览模式 ## 2.1.4 (@zee) - 修复设置`animationFunc`导致页面切换错误的 bug ## 2.1.3 (@zee) - 修复`popAndSwitchRoute`在安卓下的 bug ## 2.1.1 (@zee) - 添加`animationPrefix`参数可以配置动画的`class`前缀 - 添加`animationFunc`参数可以配置动画的 Function - `switchRoute`添加可选参数`isShadow`,指示是否采用`replace`模式替换当前`state/URL`,默认为`false` ## 2.1.0 - 目标视图完成渲染之后再执行视图切换(@zee) - 添加配置视图切换动画:(@zee) *`Cyra.initApp`中设置`animation``true` * 可添加以下可选参数进行动画配置,动画基于`CSS Animation` * `switchDuration: number`:指示动画切换持续时间,单位`ms`,默认`320` * `animationPrefix: string`:自定义动画`keyframes`前缀,默认`''` * `animationFunc: string`:自定义动画`timing-function`,默认为`''` * 开启动画模式后,在项目中添加如下4个 Animation Keyframes: * `left-move-in`:当前视图从左侧进入动画 * `left-move-out`:当前视图向左侧滑出动画 * `right-move-in`:下一视图从右侧进入动画 * `right-move-out`:下一视图向右侧滑出动画 * 可按照如下配置: ```html <style> @keyframes left-move-in { from { transform: translateX(-100%); } to { transform: translateX(0); } } @keyframes left-move-out { from { transform: translateX(0); } to { transform: translateX(-100%); } } @keyframes right-move-in { from { transform: translateX(100%); } to { transform: translateX(0); } } @keyframes right-move-out { from { transform: translateX(0); } 99% { transform: translateX(100%); } to { transform: translateX(-100%); } } </style> ``` ## 2.0.8 - bug fix(@zee) ## 2.0.7 - bug fix(@zee) ## 2.0.6 - 添加 Cyra devtools helpers(@zee) ## 2.0.5 - 迁移`popAndSwitchRoute`至多页降级方案(@zee) ## 2.0.4 - 修复在 Android 4.2 等设备中,由于 WebView 初次加载页面时自动触发`popstate`事件导致的初始视图重复加载 bug(@zee) - 完善 Nginx 配置(@zee) ## 2.0.3 - 修正 DOM 显示错误(@zsky) ## 2.0.1 - 2.0.2 - bug fix(@zsky) ## 2.0.0(@zee) - `Page`中不用再写`id()`方法。 - 去除`Action`概念,路由跳转直接使用`Route`- API 变化: * 去除`Page``defineActions`方法 * `Page.performAction (action: Action, data?: any)` => `Page.switchRoute (toPath: string, data?: any, copyIndex?: number)` * `prepareForAction (next: Function, action: Action, destinationPagePerform: Function)` => `prepareForSwitch (next: Function, toPath: string, destinationPagePerform: Function)` * `Page.reload (currentAction: Action)` => `Page.reload (previousPath: string)` - `Cyra.initApp`方法添加配置参数: * `appRoot`:项目在服务器上的虚拟路径地址,如一元夺宝为:/resource/wa/oneyuan/ * `mode`:使用的路由方式(`history`/`hash`/`multipage`),缺省表示默认使用 History API,如浏览器不支持则使用多页降级。若指定该配置参数,则使用对应路由方式。 * `paramPrefix`:配置强数据通过 URL 传递时的前缀,默认为:`cpr_` * `routes`:取代原有的`Cyra.defineRoute`方法来配置路由(例:`{..., routes: {detail: detail, ...},...}`- 实现 History API 路由方式,并完成多页降级,主要体现在弱数据处理。 - 增加数据存储接口: * `AppStorage.set(key: string, data: any)` * `AppStorage.save()` * `AppStorage.get(key: string)` * `AppStorage.clear(key: string)` * `AppStorage.clearAll()` - 本地开发过程中,需要在 mock 中添加以下配置完成 rewrite: * `select(match('/resource/wa/proj/page'), proxy.url('/page.html'))` * `select(match('/resource/wa/proj/page/*'), proxy.url('/page.html'))` - 在线上机器的 nginx 增加如下配置: ```Apache # match img resource location ~* ^/resource/wa/([\w-.]+)/([\w-.]+)(/.*)?$ { root /resource_static/; try_files /resource/$1/$2/$3 /resource/$1/$2 /resource/$1/$3 /resource/$1/$2.html =404; }` ``` ## 1.3.0 (@zsky) - 每个`Page`只需 export 类而不用 export 类的实例。 - 添加`Page.beforeLeaving`接口,用来模拟拦截点击返回按钮。 - 添加`Page.popAndSwitchRoute`接口,后退 n 个 view 然后执行`Page.switchRoute`## 1.0.0 ~ 1.2.8 (@zsky) - all