export default {
name: '',
components: {
},
props: [],
data() {
return {
}
},
watch: {
// 监听路由对象
'$route': {
handler: 'fetchData',
immediate: true // 立即触发
}
},
methods: {
fetchData() {
// 根据路由的参数重新加载数据
this.leafId = this.$route.params.leafId; // 获取路由参数
// 执行数据加载逻辑,例如 API 调用
this.getQd();
},
getQd() {
this.$ajaxGet("/classChapterSignIn/getTeacherQdByLeafId/" + this.leafId,
(data) => {
if (data.result === undefined) {
this.show = false;
} else {
this.obj = data.result;
this.show = true;
}
})
},
},
mounted() {
this.projectId = this.$route.params.id; //当前项目的id
this.leafId = this.$route.params.leafId; //小节id
this.getQd();
},
destroyed() {
},
created() {
}
}
vue监听路由
最新推荐文章于 2024-09-14 09:50:15 发布