正如Antony所说,由于您已经在router/index.js
中启用了props,因此可以像这样在router.push
中传递参数:
router.push({
name: 'events',
params: {
items: data
}
});
那么你就能够在 EventsDisplay.vue
组件中通过 props 接收 items
。
export default {
name: 'eventsDisplay',
props: ['items'],
};
this.items
应该可以工作。由于它与这个问题无关,您可以打开另一个问题并将您的代码粘贴在那里。 - choasiathis.$route.params.items
获取它。 - juacompethis.$store.commit('changeDataState', this.$data);
this.$router.push({name: 'user-post-create'});
created () {
console.log('state', this.$store);
this.$store.getters.Data;
}
{
path: "/pay-now",
name: "pay",
props: true,
component: () =>
import(/* webpackChunkName: "about" */ "../components/account/pay.vue"),
beforeEnter: AuthGuard,
},
然后像这样通过路由传递props
this.$router.push({
name: "pay",
params: {
result:this.result,
}
});
activities
吗? - choasia