Home

Harmony 状态管理

Harmony 状态管理 状态变量分类 根据状态变量的影响范围,将所有的装饰器可以大致分为: 管理组件拥有状态的装饰器:组件级别的状态管理,可以观察组件内变化,和不同组件层级的变化,但需要唯一观察同一个组件树上,即同一个页面内。 管理应用拥有状态的装饰器:应用级别的状态管理,可以观察不同页面,甚至不同UIAbility的状态变化,是应用内全局的状态管理。 从数据的传递形式和同步类型层面看,装饰器也可分为: 只读的单向传递; 可变更的双向传递。 管理组件拥有的状态 @State:@State装饰的变量拥有其所属组件的状态,可以作为其子组件单向和双向同步的数据源。当其数值改变时,会引起相关组件的渲染刷新。 @Prop:@Prop装饰的变量...

Read more

Flutter Project

20 Amazing Flutter Open-Source Projects to Know in 2023 Reference 20 Amazing Flutter Open-Source Projects to Know in 2023

Read more

Harmony ArkTS

Harmony ArkTS ArkTS是在TypeScript上扩展. UI是声明式, 设置属性和事件链式调用. Decorator @Component 自定义组件, ArkTS卡片 @Entry 入口组件, ArkTS卡片, 一个页面有且只有一个 @State 状态变量 @Builder @Component轻量实现 @BuilderParam @BuilderParam用来装饰指向@Builder方法的变量, 为自定义组件增加特定的功能. 类似slot @Styles @Styles装饰器可以将多条样式设置提炼成一个方法 @Extend @Extend,用于扩展原生组件样式 多态样式 stateSt...

Read more

Harmony Introduce

Harmony Introduce UI框架: * 声明式 * 类Web 应用模型: Feature Ability, FA Stage Stage模型应用程序包结构 一个应用可以包含多个Module Module分为”Ability”和”Library” “Ability” - 对应编译后HAP (Harmony Ability Package) “Library” - 对应编译后HAR(Harmony Archive), 或HSP(Harmony Shared Package) 一个Module可以包含多个UIAbility组件 DevEco Studio使用ohpm把应用编译为一个或多个.hap后缀的文件. ...

Read more

JS Prototype

JS Prototype JS 查找属性会依次查看原型, 直到找到或者原型为null为止 # 指定someObject原型 someObject.[[Prototype]] # 读取及设置原型 Object.getPrototypeOf() Object.setPrototypeOf() obj.__proto__ # 非标准 __proto__ syntax Prototype setter A property definition of the form proto: value or “proto”: value does not create a property with the name proto. Instead, if the prov...

Read more

JS modules

JS modules basic-modules index.html main.js modules/ canvas.js square.js Exporting module features export statement can export functions, var, let, const, class. need top-level export { name, draw, reportArea, reportPerimeter }; Importing features into your script import { name, draw, reportArea, reportPerimeter } from "./mo...

Read more