onLoad(options) {
if(options.hasOwnProperty("xxx") && options.xxx!=""){
this.xxx= options.xxx
}
} - 发布:2023-06-07 11:38
- 更新:2023-06-07 11:38
- 阅读:623
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 22H2
HBuilderX类型: 正式
HBuilderX版本号: 3.8.4
手机系统: Android
手机系统版本号: Android 8.0
手机厂商: 华为
手机机型: P9
页面类型: nvue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
在nvue页面的onLoad()生命周期函数内
使用options.hasOwnProperty("") 判断是否存在某参数
在nvue页面的onLoad()生命周期函数内
使用options.hasOwnProperty("") 判断是否存在某参数
预期结果:
正常编译完成
正常编译完成
实际结果:
编译报错:TypeError: options.hasOwnProperty is not a function
编译报错:TypeError: options.hasOwnProperty is not a function
bug描述:
在nvue页面的onLoad()函数里面使用hasOwnProperty判断是否存在参数,结果报错:
TypeError: xxx.hasOwnProperty is not a function
onLoad(options) {
console.log(options);
if(options.hasOwnProperty("") && options.!=""){
this.xxx= options.xxx
}
}
0 个回复