【问题标题】:How to use Manual Routing inside Vuex actions?如何在 Vuex 操作中使用手动路由?
【发布时间】:2020-03-17 16:19:31
【问题描述】:

我正在尝试在 Vuex 操作

中使用 $navigateTo 函数
  • _this.$navigateTo 不是函数。

  • Vue.prototype.$navigateTo(Test) 也毫无意义,因为您无法在组件之间导航。

  • $navigateToVuex.Store 中不存在

如何使用 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

【问题讨论】:

    标签: nativescript-vue


    【解决方案1】:

    原来Vue.prototype.$navigateTo(Test) 是正确答案

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

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

    【讨论】:

      猜你喜欢
      • 2017-04-05
      • 2019-12-09
      • 2018-08-10
      • 1970-01-01
      • 2017-06-29
      • 1970-01-01
      • 2021-08-19
      • 2021-04-05
      • 2013-02-07
      相关资源
      最近更新 更多