HarmonyOS List提示undefined
类中定义了一个chooseIds字段列表属性,调用clear方法却提示undefined,代码如下:
import { List } from '@kit.ArkTS';
export class HealthEvaluationBean {
id: number = -1; //题目ID
qmId: number = -1; //试卷ID
title: string = '';
type: number = -1; //选择类型 1单选 2多选
needChoice: number = -1; //是否必须选择 0否 1是
backgroundImg: string = ''; //背景图
chooseIds: List<number> = new List<number>(); //记录底下列表的选择项,以此来判断单选的
systemQuestionDetailOptionVoList: SystemQuestionDetailOptionVoListBean[] = []; //答案选项列表
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
//直接代码中调用(不管chooseIds中有没有数据,都调用clear)
this.preData.chooseIds.clear()
- 1.
- 2.
//报错 TypeError: Cannot read property clear of undefined
- 1.
HarmonyOS
赞
收藏 0
回答 1
相关问题
HarmonyOS 手势注册是否能够在build()方法外写,在方法外写会提示undefined
994浏览 • 1回复 待解决
List滚动到底部提示,是否有好的解决方案?
1838浏览 • 1回复 待解决
HarmonyOS Object is possibly 'undefined'. <ArkTSCheck>报错
875浏览 • 1回复 待解决
HarmonyOS UIAbilityContext.openLink 为 undefined
646浏览 • 1回复 待解决
HarmonyOS创建前置广角相机返回undefined
766浏览 • 1回复 待解决
HarmonyOS SourceTool.xxx值为undefined
745浏览 • 1回复 待解决
使用fetch报错,fetch undefined
8049浏览 • 2回复 待解决
HarmonyOS CustomDialog中的CustomDialogController 为undefined
1059浏览 • 1回复 待解决
HarmonyOS Cannot set property when setter is undefined
738浏览 • 1回复 待解决
HarmonyOS CustomDialogController一直是undefined
902浏览 • 1回复 待解决
HarmonyOS代码报错 cannot read property aboutToRender of undefined
1205浏览 • 1回复 待解决
HarmonyOS List嵌套List和List嵌套Grid问题
696浏览 • 1回复 待解决
如何获取单例为undefined
1161浏览 • 1回复 待解决
建前置广角相机返回undefined
189浏览 • 0回复 待解决
HarmonyOS error: undefined symbol: OH_ImageNative_GetImageSize
431浏览 • 1回复 待解决
HarmonyOS 4.0 hdc使用hdc list targets 报empty,hdc install提示[Fail]ExecuteCommand need connect-key?
8725浏览 • 1回复 待解决
HarmonyOS 调试报错TypeError:Cannot read property xxx of undefined
2067浏览 • 1回复 待解决
HarmonyOS list嵌套list,scrollToItemInGroup不执行
627浏览 • 1回复 待解决
HarmonyOS List嵌套list中的布局
693浏览 • 1回复 待解决
openssl库编译会报undefined symbol: __errno
1907浏览 • 1回复 待解决
编译工程“undefined reference to `pthread_create'”
6290浏览 • 2回复 已解决
undefined symbol napi_create_threadsafe_function
5006浏览 • 1回复 待解决
参考示例如下:
需要实例化JSON.parse()并不会实例化对象。