提交 8d355c17 编写于 作者: S swx1239486

一多akrts预警整改

Signed-off-by: Nswx1239486 <songqinqin4@huawei.com>
上级 2645ede8
...@@ -52,16 +52,16 @@ ...@@ -52,16 +52,16 @@
```ts ```ts
// MainAbility.ts // MainAbility.ts
import type window from '@ohos.window' import window from '@ohos.window'
import display from '@ohos.display' import display from '@ohos.display'
import Ability from '@ohos.app.ability.Ability' import Ability from '@ohos.app.ability.Ability'
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
private windowObj: window.Window private windowObj?: window.Window
private curBp: string private curBp: string = ''
//... //...
// 根据当前窗口尺寸更新断点 // 根据当前窗口尺寸更新断点
private updateBreakpoint(windowWidth) :void{ private updateBreakpoint(windowWidth: number) :void{
// 将长度的单位由px换算为vp // 将长度的单位由px换算为vp
let windowWidthVp = windowWidth / (display.getDefaultDisplaySync().densityDPI / 160) let windowWidthVp = windowWidth / (display.getDefaultDisplaySync().densityDPI / 160)
let newBp: string = '' let newBp: string = ''
...@@ -166,7 +166,7 @@ export class BreakpointType<T> { ...@@ -166,7 +166,7 @@ export class BreakpointType<T> {
this.md = md this.md = md
this.lg = lg this.lg = lg
} }
GetValue(currentBreakpoint: string):T { GetValue(currentBreakpoint: string):T | undefined{
if (currentBreakpoint === 'sm') { if (currentBreakpoint === 'sm') {
return this.sm return this.sm
} }
...@@ -182,9 +182,9 @@ export class BreakpointType<T> { ...@@ -182,9 +182,9 @@ export class BreakpointType<T> {
export class BreakpointSystem { export class BreakpointSystem {
private currentBreakpoint: string = 'md' private currentBreakpoint: string = 'md'
private smListener: mediaquery.MediaQueryListener private smListener?: mediaquery.MediaQueryListener
private mdListener: mediaquery.MediaQueryListener private mdListener?: mediaquery.MediaQueryListener
private lgListener: mediaquery.MediaQueryListener private lgListener?: mediaquery.MediaQueryListener
private updateCurrentBreakpoint(breakpoint: string) :void{ private updateCurrentBreakpoint(breakpoint: string) :void{
if (this.currentBreakpoint !== breakpoint) { if (this.currentBreakpoint !== breakpoint) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册