我定义了下面的路由:
{
path:"/patientTwo",
name:"patientTwo",
component:()=>import('/@/views/patient/two.vue'),
meta:{
title:'门诊签到2',
}
},
我想通过按钮跳转到这个页面:
<script setup>
import {useRouter} from 'vue-router'
const router=useRouter()
const goUrl=()=>{
router.push(
{
path:'/patientTwo'或 name:"patientTwo"
}
)
}
</script>
上面的不管path:'/patientTwo'或 name:"patientTwo"的写法都跳转不过去,为什么?
看你的报错信息提示应该是没有找到这个异步组件
/src/views/patient/two.vue
。你看看你的src文件夹下是否有这个组件,还有这个组件是否正确导出了。