##根据路径做一些判断 eg:如果请求路径中有id就执行getInfo方法
//页面渲染之前执行
created(){
//判断路径中是否有id值
if(this.$route.params && this.$route.params.id){
//从路径中获取id值
const id = this.$route.params.id
//调用根据id查询的方法
this.getInfo(id)
}
},
##路由跳转
this.$router.push({path:'/teacher/table'})
##路由监听
//监听
watch:{
$route(to,from){ //路由变化方式 路由发生变化 方法就会执行
this.init()
}
},