vue-router back()不起作用



我为Chrome创建一个扩展名,我在其中使用Vue和Vue-Router。

要浏览我使用router.push()的页面,并且效果很好。问题是我不工作过渡。

<template>
<a href="#" class="left" @click="back">
  <i class="icon-fontello-left"></i>
</a>
</template>
<script>
export default {
  methods: {
    back(){
      console.log('back click, current', this.$router.currentRoute);
      this.$router.back();
    }
  }
}
</script>

当我单击控制台back click, current Object {name: undefined, meta: Object, path: "/settings", hash: "", query: Object…}时,但不会发生过渡,也没有错误。

我尝试了不同的选项:

this.$router.back()
this.$router.go(-1)

但是它们都没有工作

版本:

"vue-router": "^2.7.0",
"vue": "^2.4.1"

您是否尝试过手动操纵历史API来查看发生了什么?

https://developer.mozilla.org/en-us/docs/web/api/history_api

似乎您可能需要设置权限:

https://developer.chrome.com/extensions/thistory我不确定这一点可能会有所帮助。

最新更新