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