登录  注册

首页->鸿蒙高级认证

开发者在编写ArkUI代码时,想要提前预览下所编写的组件的效果,下述哪个组件可以使用DevEco Studio Previewer正常预览?( )

(A)@Preview @Component struct TitleSample { @StorageProp('title') title: string = 'PlaceHolder'; build() { Text(this.title) } }

(B) @Preview @Component struct LinkSample { @Link message: string; build() { Text(this.message) } }

(C) @Preview @Component struct ConsumeSample { @Consume name: string; build() { Text(this.name) } }

(D) import { add } from 'libnative.so'; @Preview @Component struct NativeSample { count: number = add(1, 2); build() { Text(current count is ${this.count}) } }

(B) link变量没有初始化 C Consumer没有提供Provider D 没有add具体方法,需要自定义mock

参考答案
继续答题:下一题
微考学堂微考学社

更多鸿蒙高级认证试题

考试