HarmonyOS WebView 圆角设置失效
Web组件在某些场景下我们不会全屏显示,且给左上角右上角设置圆角不会生效。可以用下面的demo来进行验证。
import web_webview from '@ohos.web.webview';
import business_error from '@ohos.base';
@Entry
@Component
struct Page2 {
controller: web_webview.WebviewController = new web_webview.WebviewController();
@State progress: number = 0;
@State src: string = 'https://www.huawei.com/u/bmmain/helpsale/evaluate?random=1000&channel=BM_0933&needHideHead=3&cateId=101&type=B&plainSceneId=B2COld2New&modelId=125986&brandId=10532&modelName=%E5%8D%8E%E4%B8%BA%20Mate%2060%20Pro&skip2NextUrl=https%3A%2F%2Fm.zhuanzhuan.com%2Fzlj%2Fold_for_new_service_h5%2Fvaluation%3FneedHideHead%3D3%26needNewWebview%3D1%26serviceIds%3D%26productId%3D1779861808894005248%26metric%3D%26from%3Dc2b%26isUserEval%3D1';
;
build() {
Column() {
Row().height('30%')
Stack() {
Web({ src: this.src, controller: this.controller })
.borderRadius({ topLeft: 100, topRight: 100, bottomLeft: 0, bottomRight: 0 })
.javaScriptAccess(true)
.domStorageAccess(true)
.onProgressChange((event) => {
this.progress = event?.newProgress || 0;
// console.log(`progress: ${this.progress}`);
})
.height('100%')
Column({ space: 20 }) {
Text(`progress: ${this.progress}`).fontSize(30).fontColor(Color.Black)
Button('loadUrl')
.onClick(() => {
try {
this.controller.setCustomUserAgent("zzVersion/8.18.20 zzT/16 zzDevice/1_44.0_3.0 zzApp/58ZhuanZhuan");
const customUa = this.controller.getCustomUserAgent();
const ua = this.controller.getUserAgent();
console.log(`customUa: ${customUa}, ua: ${ua}`);
} catch (error) {
let e: business_error.BusinessError = error as business_error.BusinessError;
console.error(`ErrorCode: ${e.code}, Message: ${e.message}`);
}
})
}
}
.height('70%')
}.backgroundColor(Color.Black)
}
}
HarmonyOS
赞
收藏 0
回答 1
待解决
相关问题
WebView支持设置WebView圆角吗?
1277浏览 • 1回复 待解决
HarmonyOS webView缓存失效
180浏览 • 1回复 待解决
HarmonyOS webview中loadUrl(this.url, headers)设置header一直失效
193浏览 • 1回复 待解决
HarmonyOS 设置userAgent失效
325浏览 • 1回复 待解决
HarmonyOS Swiper嵌套图片,滑动过程中圆角失效
370浏览 • 1回复 待解决
HarmonyOS CustomDialog怎么设置圆角
454浏览 • 1回复 待解决
HarmonyOS Canvas如何设置圆角
359浏览 • 1回复 待解决
HarmonyOS Span的属性设置失效
232浏览 • 1回复 待解决
HarmonyOS 屏幕常亮设置失效
356浏览 • 1回复 待解决
HarmonyOS Progress如何设置左边圆角。右边不需要圆角。
465浏览 • 1回复 待解决
HarmonyOS stack设置圆角不生效
566浏览 • 1回复 待解决
HarmonyOS span中如何设置圆角
746浏览 • 1回复 待解决
HarmonyOS bindSheet怎么设置圆角大小
216浏览 • 1回复 待解决
HarmonyOS TextInput设置showCounter时,margin失效
475浏览 • 1回复 待解决
UIAbility是否可以设置圆角
2082浏览 • 1回复 待解决
HarmonyOS column设置圆角不起作用
1035浏览 • 1回复 待解决
HarmonyOS 怎么设置带圆角的渐变边框
434浏览 • 1回复 待解决
HarmonyOS 图片背景及边框圆角设置问题
1646浏览 • 1回复 待解决
HarmonyOS ClipShape如何设置仅顶部有圆角?
155浏览 • 1回复 待解决
控件enabled设置为false时,hover失效
2698浏览 • 1回复 待解决
HarmonyOS webview如何设置sessionStorage
213浏览 • 1回复 待解决
HarmonyOS 设置宽度为100%则左右边距失效
368浏览 • 1回复 待解决
HarmonyOS c++版本设置线性渐变的角度失效
309浏览 • 1回复 待解决
ImageKnife加载图片,设置圆角显示有问题
798浏览 • 1回复 待解决
如何设置分组列表的圆角和间距
2321浏览 • 1回复 待解决
设置clip为true可以实现。关于clip参考文档https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-universal-attributes-sharp-clipping-V5