为什么使用 router.push 在控制台中出现错误?

And*_*rew 4 ionic-framework vue.js vue-router

节点 v16.13.2

我的包.json

"dependencies": {
    "@capacitor/android": "3.4.3",
    "@capacitor/app": "1.1.0",
    "@capacitor/core": "3.4.1",
    "@capacitor/haptics": "1.1.4",
    "@capacitor/keyboard": "1.2.2",
    "@capacitor/status-bar": "1.0.8",
    "@ionic/vue": "^6.0.13",
    "@ionic/vue-router": "^6.0.13",
    "@popperjs/core": "^2.11.2",
    "axios": "^0.25.0",
    "core-js": "^3.6.5",
    "vue": "^3.2.31",
    "vue-axios": "^3.4.0",
    "vue-router": "^4.0.14",
    "vuex": "^4.0.2"
  },
  "devDependencies": {
    "@babel/eslint-parser": "^7.17.0",
    "@babel/eslint-plugin": "^7.16.5",
    "@capacitor/cli": "3.4.1",
    "@vue/cli-plugin-babel": "^5.0.4",
    "@vue/cli-plugin-eslint": "^5.0.4",
    "@vue/cli-service": "^5.0.4",
    "@vue/compiler-sfc": "^3.2.31",
    "eslint": "^8.12.0",
    "eslint-plugin-vue": "^8.5.0",
    "eslint-webpack-plugin": "^3.1.1"
  },
Run Code Online (Sandbox Code Playgroud)

Vue组件

<ion-card
v-for="(page, index) in pageList" :key="index"
@click="() => this.$router.push('/stock/view/' + page.id)">
Run Code Online (Sandbox Code Playgroud)

或者

v-on:click="pageSelected('/stock/view/' + sel.id)"
Run Code Online (Sandbox Code Playgroud)
pageSelected(route) {
    if (route) this.$router.push(route);
},
Run Code Online (Sandbox Code Playgroud)

没有[Vue warn]: Unhandled error during execution of native event handler

vue-router.esm-bundler.js?ec2d:2489 Uncaught (in promise) TypeError: api.now is not a function当我点击链接时出现错误。

如果我降级版本,我会收到新的错误。

我哪里错了?

错误截图

在此输入图像描述

尝试降级 npm 数据包版本,但出现新的另一个错误。

Update: Need to update the browser Chrome to the latest version!

Riy*_*han 11

发生这种情况是因为 Vue Router 中的一些新更新,我和我的同事都通过安装新的稳定版本的 Vue Devtools解决了这个问题

请卸载现有的 Devtool 扩展并下载此稳定版本:https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd ?hl=en