You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
808 B
44 lines
808 B
1 year ago
|
<template>
|
||
|
<h3>这事Test</h3>
|
||
|
<button @click="goAboutParams">GotoAbout</button>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
|
name: "TestView",
|
||
|
methods: {
|
||
|
// 字符串路径
|
||
|
goAbout: function () {
|
||
|
this.$router.push('/about')
|
||
|
},
|
||
|
//对象形式的path
|
||
|
goAboutPath: function () {
|
||
|
this.$router.push({path: '/about'})
|
||
|
},
|
||
|
// 带params的push请求
|
||
|
goAboutParams: function () {
|
||
|
this.$router.push({
|
||
|
name: 'about-params',
|
||
|
params: {
|
||
|
id: 1,
|
||
|
name: 'roger'
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
// 带参数的router.push
|
||
|
goAboutQuery: function () {
|
||
|
this.$router.push({
|
||
|
name: 'about',
|
||
|
// query: {...this.$route.query} // 映射query
|
||
|
query: {id: 1}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
|
||
|
<style scoped>
|
||
|
|
||
|
</style>
|