Compare commits

..

3 Commits

Author SHA1 Message Date
b64bd050bd js 跳转传值 2021-07-06 16:49:04 +08:00
40784994d1 路由传值 2021-07-06 16:44:22 +08:00
727a943474 最基础的跳转 2021-07-06 16:36:32 +08:00
4 changed files with 35 additions and 6 deletions

View File

@ -3,7 +3,7 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "start": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },

View File

@ -1,5 +1,7 @@
<template> <template>
<div>这是bar</div> <div>这是bar
<router-link to="/">到首页</router-link>
</div>
</template> </template>
<style scoped> <style scoped>

View File

@ -1,11 +1,20 @@
<template> <template>
<div>这是foo</div> <div>这是foo
<router-link to="/bar">到bar</router-link>
<button @click="getzhi">获取传值</button>
</div>
</template> </template>
<style scoped> <style scoped>
</style> </style>
<script> <script>
export default { export default {
methods:{
getzhi(){
// url
let zhi = this.$route.query
console.log(zhi)
}
}
} }
</script> </script>

View File

@ -1,3 +1,21 @@
<template> <template>
<div>这是首页</div> <div>
这是首页
<!-- 不能用a标签 -->
<!-- <a href="/foo">到foo</a> -->
<!-- <router-link to="/foo">到foo</router-link> -->
<button @click="tiaozhuan">用js跳转</button>
<router-link :to="{path:'/foo',query:{name:123,age:234,asda:1411}}">到foo</router-link>
</div>
</template> </template>
<script>
export default {
methods:{
tiaozhuan(){
// js this.$router.push
this.$router.push({path:'/foo',query:{name:123,age:234,asda:1411}})
}
}
}
</script>