路由传值
This commit is contained in:
parent
727a943474
commit
40784994d1
@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<div>这是foo
|
||||
<router-link to="/bar">到bar</router-link>
|
||||
<button @click="getzhi">获取传值</button>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
@ -8,6 +9,12 @@
|
||||
</style>
|
||||
<script>
|
||||
export default {
|
||||
|
||||
methods:{
|
||||
getzhi(){
|
||||
// 如何获取url传值
|
||||
let zhi = this.$route.query
|
||||
console.log(zhi)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -3,6 +3,15 @@
|
||||
这是首页
|
||||
<!-- 不能用a标签 -->
|
||||
<!-- <a href="/foo">到foo</a> -->
|
||||
<router-link to="/foo">到foo</router-link>
|
||||
<!-- <router-link to="/foo">到foo</router-link> -->
|
||||
<button>用js跳转</button>
|
||||
<router-link :to="{path:'/foo',query:{name:123,age:234,asda:1411}}">到foo</router-link>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
methods:{
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user