vue3关于路由query传参
传参import { useRouter } from "vue-router";const router = useRouter();router.push({ path: "/Detail", query: { id:"123" } });接受import { useRoute } from "vue-router";const route = useRoute();console.log(r
·
传参
import { useRouter } from "vue-router";
const router = useRouter();
router.push({ path: "/Detail", query: { id:"123" } });
接受
import { useRoute } from "vue-router";
const route = useRoute();
console.log(route.query.id);
注意:
需要引入路由,在setup()创建对象,再使用,区分引入路由不同
传参是router, 引入useRouter
接收参数是route, 引入useRoute
更多推荐
已为社区贡献2条内容
所有评论(0)