1234567891011121314151617181920212223242526272829 |
- <template>
- <div class="col-xs-offset-2 col-xs-8">
- <div class="page-header">
- <h2>Vue Router Demo</h2>
- <button @click="back">后退</button>
- <button @click="forward">前进</button>
- <button @click="test">测试一下go</button>
- </div>
- </div>
- </template>
- <script>
- export default {
- name:'Banner',
- methods: {
- back(){
- this.$router.back()
- // console.log(this.$router)
- },
- forward(){
- this.$router.forward()
- },
- test(){
- // go需要传入一个数字,正数表示前进,负数表示后退
- this.$router.go(3)
- }
- },
- }
- </script>
|