新版微信在蘋果iOS 端的h5頁面如果有路由跳轉,會出現底部白色導航條,出現此情況的原因是:
由於底部導航欄是因爲出現history記錄
纔出現的。使用replace就沒有history記錄,解決辦法
使用history.replace代替history.push
比如Vue中解決方式:
1 . dom跳轉: <router-link :to="pageUrl" replace></router-link>
2. js跳轉: this.$router.replace('/pageUrl')
-------------------------------------------------------------------------------------------------
vue-router的push和replace的區別
1.this.$router.push()
描述:跳轉到不同的url,但這個方法會向history棧添加一個記錄,點擊後退會返回到上一個頁面。
2.this.$router.replace()
描述:同樣是跳轉到指定的url,但是這個方法不會向history裏面添加新的記錄,點擊返回,會跳轉到上上一個頁面。上一個記錄是不存在的。
3.this.$router.go(n)
相對於當前頁面向前或向後跳轉多少個頁面,類似 window.history.go(n)
。n可爲正數可爲負數。正數返回上一個頁面