如何在 Vuex 操作中使用手动路由?

How to use Manual Routing inside Vuex actions?

我正在尝试在 Vuex 操作中使用 $navigateTo 函数

如何使用 Vuex 动作导航 nativescipt-vue?


import Vue from "vue";
import Vuex from "vuex";
import Test from "./components/Test.vue";

Vue.use(Vuex);

export default new Vuex.Store({
  actions: {
    go() {
      this.$navigateTo(Test); 
//Property '$navigateTo' does not exist on type 'Store<unknown>'.
    }
  }
});

请查看我的仓库 即使密码为空,它也会导航到测试页面

https://github.com/kaanguru/vuexnavigate

https://nativescript-vue.org/en/docs/routing/manual-routing/#navigatetocomponent-options

事实证明 Vue.prototype.$navigateTo(Test) 是正确答案

Vue.prototype.$navigateTo(Test) is also pointless since you can't navigate between components.

不,您可以在组件之间导航并非毫无意义。