微信小程序内嵌web-view组件, 测试小程序体验版, 微信客户端版本是8.0.13, 基础库版本是:3.11.3, 我的小程序中web-view是有个默认值,在onLoad时会判断外部传过来的信息有无链接,有链接则会更新url,但鸿蒙中有时候就一直渲染的是默认值, 新的链接不渲染, 执行步骤:
当点击H5页面中立即体验按钮时, 会执行这段 if (detectMiniProgramEnv()) {
const urlWithoutHash = window.location.href.split("#")[0];
const fullUrl = encodeURIComponent(
`${urlWithoutHash}#/tideTravelHome${
this.token ? `?token=${this.token}` : ""
}`
);
window.wx.miniProgram.redirectTo({
url: `/pages/webview/webview?url=${fullUrl}`
});
}其中fullUrl编码前类似这样的地址https://test.cmxcode.com/cdn/cl/#/aiIntro 在鸿蒙6.0.0版本中需要点击立即体验按钮多次, 才能达到redirectTo 来“刷新”同一个页面, 才能从当前 web-view页面/pages/webview/webview, redirectTo跳转到同一个页面, 才会更新url, 但偶尔点一次也能刷新页面, 有时需要点好几次才刷新页面, 是什么情况? 安卓下点一次就能redirectTo到对应的页面, 更新web-view组件的src
