vue3中使用router路由实现跳转传参
2024-05-27大家好,今天和大家分享一下vue3中如何进行跳转并进行传参。前言vue3取消了vue2部分api,所以路由跳转和传值的方式会有所不同。我们今天主要讲router.push(location, onComplete?, onAbort?vue3中新增API:useRouter和useRoute。_vue3 router push
Vue3 关于router引起的[Vue warn]: inject() can only be used inside setup() or functional
2024-05-22该router的使用会报警告inject() can only be used inside setup() or functional;原因在于useRouter。引入示例:import router from "@/router/index.ts"在setup中使用,因此在模块中调用会出现警告,参考文档。使用useStore同理。..._runtime-core.esm-bundler.js:41 [vue warn]: inject() can only be used inside