提交 33dd0544 编写于 作者: S swx1239486

一多akrts预警整改

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