浏览代码

state.href needs to be updated only in web mode without base

Shaun 2 年之前
父节点
当前提交
07dd169619
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/index.js

+ 3 - 1
src/index.js

@@ -68,7 +68,9 @@ export default function (Alpine) {
     state.params = router.match(url)
   })
 
-  Alpine.nextTick(() => state.href = location.href)
+  Alpine.nextTick(() => {
+    if (state.mode === 'web' && !state.base) state.href = location.href
+  })
   window.addEventListener('popstate', () => state.href = location.href)
 
   function push (path, options = {}) {