HarmonyOS 报错Cannot find name 'backgroundColor'. Did you mean the instance member 'this.backgroundColor'?
自定义的CardView想在调用的地方设置backgroundColor等属性值,无法设置报以上错误。
// 自定的CardView
@Component
export struct CardView {
@BuilderParam private content: () => void // 控件占位符
build() {
Column() {
this.content()
}
.shadow({
radius: 6,
color: Color.Grey,
offsetX: 0,
offsetY: 0
})
.padding({
left: 30,
right: 30,
top: 20,
bottom: 20
})
.borderRadius(6)
.alignItems(HorizontalAlign.Start)
}
}
// 调用CardView
CardView() {
Row() {
}.width("100%")
}
.backgroundColor(Color.White) // 这里报错:Cannot find name 'backgroundColor'. Did you mean the instance member 'this.backgroundColor'?
HarmonyOS
赞
收藏 0
回答 1
待解决
相关问题
HarmonyOS Cannot find name 'ESObject'
426浏览 • 0回复 待解决
getContext 提示错误,Cannot find name 'getContext'
1304浏览 • 1回复 待解决
HarmonyOS 如何实现一个ViewModelFactory,当前会报错cannot find name 'T'
228浏览 • 0回复 待解决
Span设置backGroundColor不生效是为什么?
834浏览 • 1回复 待解决
HarmonyOS http请求报错could not find host name
412浏览 • 1回复 待解决
HarmonyOS bindContextMenu中设置backgroundColor不生效
655浏览 • 1回复 待解决
在TS文件里使用Concurrent注解报红,提示Cannot find name 'Concurrent'
1491浏览 • 1回复 待解决
HarmonyOS CustomDialog中backgroundColor无法设置透明颜色
388浏览 • 1回复 待解决
openharmony源码编译报错importerror:cannot import name
8985浏览 • 1回复 已解决
HarmonyOS entry module中引用hsp报错cannot find record...
2077浏览 • 1回复 待解决
HarmonyOS Web设置 .backgroundColor(Color.Transparent)还是白色的
270浏览 • 1回复 待解决
将一个文件,从原文件下移出后,Cannot find name 'CustomDialogExample',无法引用
545浏览 • 1回复 待解决
HarmonyOS BLECharacteristic类型的全局变量可选变量如何设置,提示Cannot find name 'BLECharacteristic'.应该导入什么包
266浏览 • 1回复 待解决
HarmonyOS 同一个颜色值,为啥backgroundColor和linearGradient显示的不一样
400浏览 • 1回复 待解决
DevEco Studio出现Gradle sync failed: Cannot find JAR错误
5733浏览 • 1回复 待解决
HarmonyOS源码编译错误 importerror:cannot import name
5022浏览 • 1回复 已解决
DevEco Studio 升级报错 Cannot find JAR 'jaxb-impl-2.3.2.jar' required by module 'gradle-resources-s3
8187浏览 • 2回复 已解决
Cannot find module '@ohos.application.Ability' or its corresponding type declarations.
12764浏览 • 1回复 待解决
安装pcre报错“You need a C++ compiler for C++ support.”
3038浏览 • 1回复 待解决
参考示例如下: