未验证 提交 8b4a94ae 编写于 作者: S songqq0825 提交者: Gitee

register方案补充初始化操作以及代码模块分割优化

Signed-off-by: Nsongqq0825 <songqinqin4@huawei.com>
上级 f92bb9b0
...@@ -210,10 +210,22 @@ export class BreakpointSystem { ...@@ -210,10 +210,22 @@ export class BreakpointSystem {
public register() { public register() {
this.smListener = mediaquery.matchMediaSync("(320vp<width<600vp)") this.smListener = mediaquery.matchMediaSync("(320vp<width<600vp)")
//初始化
if (this.smListener.matches){
this.updateCurrentBreakpoint('sm')
}
this.smListener.on("change", this.isBreakpointSM) this.smListener.on("change", this.isBreakpointSM)
this.mdListener = mediaquery.matchMediaSync("(600vp<width<840vp)") this.mdListener = mediaquery.matchMediaSync("(600vp<width<840vp)")
//初始化
if (this.mdListener.matches){
this.updateCurrentBreakpoint('md')
}
this.mdListener.on("change", this.isBreakpointMD) this.mdListener.on("change", this.isBreakpointMD)
this.lgListener = mediaquery.matchMediaSync("(840vp<width)") this.lgListener = mediaquery.matchMediaSync("(840vp<width)")
//初始化
if (this.lgListener.matches){
this.updateCurrentBreakpoint('lg')
}
this.lgListener.on("change", this.isBreakpointLG) this.lgListener.on("change", this.isBreakpointLG)
} }
...@@ -224,6 +236,9 @@ export class BreakpointSystem { ...@@ -224,6 +236,9 @@ export class BreakpointSystem {
} }
} }
```
```
// MediaQuerySample.ets // MediaQuerySample.ets
import { BreakpointSystem, BreakpointType } from '../common/breakpointsystem' import { BreakpointSystem, BreakpointType } from '../common/breakpointsystem'
...@@ -259,6 +274,7 @@ struct MediaQuerySample { ...@@ -259,6 +274,7 @@ struct MediaQuerySample {
``` ```
## 栅格布局 ## 栅格布局
### 简介 ### 简介
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册