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')
- 发布:2020-10-27 10:56
- 更新:2020-10-27 11:47
- 阅读:720
产品分类: 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')
},
请问是我条件编译写错了还是哪里没理解对?
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')