vue3使用路由实现页面跳转报错:inject() can only be used inside setup() or functional components. 电脑版发表于:2023/7/11 22:30 这样写会报错: ``` <script setup> import { useRouter } from 'vue-router' const buttonGoAbout = () => useRouter().push('/about') </script> ``` 要把useRouter()这个提出来写用一个变量装起来就好了 ``` <script setup> import { useRouter } from 'vue-router' const router = useRouter() const buttonGoAbout = () => router.push('/about') </script> ```