链接跳转
<router-link to="/index"></router> //属性to='/'即是跳转到path为'/'的路径.
<div to="/users" @click="ratego()">
methods: {
//跳转页面+链接上带参数 /users?id=xxx&hidid=xxx
ratego () {
this.$router.push({path:'/users',query:{id:this.dpId,hidid:this.hidid}});
},
}
获取url上传的参数
mounted () {
this.hidid = this.$route.query.hidid
}
v-show与v-if的区别
v-show //一开始就加载,更适用于频繁的切换
v-if //是根据后面数据的真假值判断直接从Dom树上删除或重建元素节点,更高的切换消耗,不适合做频繁的切换;