如何通过路由设置和传递 JSON 道具

How to set and pass a JSON prop through routes

在vue.js route.js

[{path: "/path", name: "acomp_name", component: PathComp, props: { abc: {} }}]

comp.vue

<script>
...omitted_for_brevity,
methods: {
  changeRoute(json_sample){
     this.$router.push({name: "acomp_name", params: { abc: json_sample })
  }
}
</script>
  1. 有没有办法可以将作为对象的 props 设置为 return json 样本,这是另一个对象,就像这样 那就是我可以在 push
  2. 中设置路由器的 props 值吗
  3. 如果 vue-router4 确实不支持它。已经使用或正在使用什么方法来做到这一点?

感谢全能的上帝帮助我创建了一个直观可靠的答案, N<>B 解决方案适用于 vue3 和 vue-router4x

在comp.vue 在模板内某处我有一个嵌套或子组件 所以

    <template>
      <p>...</p>
    ...omitted_for_brevity
    <router-view :prop_from_router.js="this.state.a_key_I_want_to_use"/>
    </template>

还在comp.vue

<script>
...omitted_for_brevity
setup(){
  const s = reactive({})
  return {s}
},
methods: {
  changeRoute(t)
  this.state.a_key_i_want_to_use = t
}
}
</script>