小程序中跳到webview页面没有返回按钮和标题

小程序利用webview标签可以跳转到h5、web页面,但是跳过去之后缺少了返回按钮和标题,解决办法如下:
在webview页面中的JSON中设置好标题

在小程序中使用webview嵌入h5页面步骤:
1.在小程序中新建一个页面/pages/myPage/index
2.在新建的index页面中使用webview嵌入h5.<web-view src='h5页面链接'></web-view>
3.在新建的myPage文件下新建index.config.ts
4.在index.config.ts中加入如下配置,保证此时的页面中有返回按钮和标题

// index.config.ts
export default {
    
    
  "backgroundTextStyle": "light",
  "navigationBarBackgroundColor": "#fff",
  "navigationBarTitleText": "我的标题",
  "navigationBarTextStyle": "black"
}

猜你喜欢

转载自blog.csdn.net/weixin_42342065/article/details/131103241