js 跳转传值

This commit is contained in:
theluyuan 2021-07-06 16:49:04 +08:00
parent 40784994d1
commit b64bd050bd

View File

@ -4,14 +4,18 @@
<!-- 不能用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> <button @click="tiaozhuan">用js跳转</button>
<router-link :to="{path:'/foo',query:{name:123,age:234,asda:1411}}">到foo</router-link> <router-link :to="{path:'/foo',query:{name:123,age:234,asda:1411}}">到foo</router-link>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
methods:{ methods:{
tiaozhuan(){
// js this.$router.push
this.$router.push({path:'/foo',query:{name:123,age:234,asda:1411}})
}
} }
} }
</script> </script>