console.log('start')
// #ifdef quickapp-webview
console.log('this is quickapp-webview')
// #endif
// #ifdef quickapp-webview-huawei
console.log('this is quickapp-webview-huawei ')
// #endif
console.log('hello world!')
console.log('end')
![4***@qq.com](https://img-cdn-tc.dcloud.net.cn/account/identicon/624c6d6506c7e89383424b9e0263c0f0.png)
- 发布:2020-10-27 10:56
- 更新:2020-10-27 11:47
- 阅读:744
产品分类: uniapp/快应用/华为
渲染模式: webview
操作步骤:
预期结果:
start
this is quickapp-webview
this is quickapp-webview-huawei
hello world!
end
start
this is quickapp-webview
this is quickapp-webview-huawei
hello world!
end
实际结果:
start
hello world!
end
start
hello world!
end
bug描述:
HBuilder X 2.8.11,华为快应用ide:3.0.1.20201010
代码添加快应用的条件编译后,编译后的代码在华为ide跑快应用时,该条件代码不生效
onShow() {
console.log('start')
// #ifdef quickapp-webview
console.log('this is quickapp-webview')
// #endif
// #ifdef quickapp-webview-huawei
console.log('this is quickapp-webview-huawei ')
// #endif
console.log('hello world!')
console.log('end')
},
请问是我条件编译写错了还是哪里没理解对?
![](http://img-cdn-tc.dcloud.net.cn/uploads/questions/20201027/d70ea0176fb2e89ef36cda2bcbc81c27.png)
![](http://img-cdn-tc.dcloud.net.cn/uploads/questions/20201027/0fb7fcbe0a1237b176fba7dec6ea4d06.png)
![4***@qq.com](https://img-cdn-tc.dcloud.net.cn/account/identicon/624c6d6506c7e89383424b9e0263c0f0.png)
4***@qq.com (作者)
找到原因了,条件编译得全部大写才行,但是官方文档给了却是小写,有点坑人。
console.log('start')
// #ifdef QUICKAPP-WEBVIEW
console.log('this is quickapp-webview')
// #endif
// #ifdef QUICKAPP-WEBVIEW-HUAWEI
console.log('this is quickapp-webview-huawei ')
// #endif
console.log('hello world!')
console.log('end')