H5 ios机型下使用了不可见的Iframe的页面在使用back() 或者go() 时的问题
问题描述:
在IOS的内嵌H5页面中的vue项目,某个页面使用了高德地图的JS SDK(2.0版本),而高德地图SDK内嵌了iframe,在ios机型下点击返回时,第一次无效,第二次才能返回成功,
解决方案如下:
(1)已知的iframe地址时: this.$refs.iframe.contentWindow.location.replace(src)
(2)使用的第三方插件中包含了iframe时,记录from路由的path,判断设备,然后进行replace(path),具体可参考store-assistant-h5项目中的 src/views/aproval/pages/detail/entry.vue页面
参考:
https://stackoverflow.com/questions/14737365/modify-iframe-src-without-entry-to-history-object
https://github.com/vuejs/vue-router/issues/1917