功能:列表跳转详情页携带参数
列表页:
import { useRouter } from 'vue-router';
const router = useRouter();
// 行点击详情页
function handleRowClick(row) {
// console.log(row);
// 跳转到详情页
router.push({ name: '/copd/copdPatientUserDetails', query: { patientId: row.patientId } });
}
详情页接收参数:
import { useRoute } from 'vue-router';
// 获取当前路由对象
const route = useRoute();
// 在组件挂载时获取患者信息
onMounted(() => {
//拿到参数
console.log(props.patientId);
const patientId = route.query.patientId;
if (patientId) {
getDetails(patientId);
follows.value = [{
date: '2017-01-01'
}, {
date: '2017-01-02'
}, {
date: '2017-01-03'
}];
}
});