-
-
Notifications
You must be signed in to change notification settings - Fork 5k
/
Copy pathapp.js
47 lines (44 loc) · 1.06 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const router = new VueRouter({
mode: 'history',
base: __dirname
})
new Vue({
router,
data () {
return {
historyLength: 0
}
},
template: `
<div id="app">
<h1>Route Query History</h1>
<ul>
<li><a @click="gotoArray">route-query-history?a=1&b=2&a=2</a></li>
<li><a @click="gotoOne">route-query-history?a=1&b=2</a></li>
<li><a @click="gotoTwo">route-query-history?b=2&a=1</a></li>
</ul>
<div>
historyLength:<span id="historyLength">{{historyLength}}</span>
</div>
</div>
`,
created () {
this.historyLength = window.history.length
},
methods: {
gotoArray () {
window.location.replace('/route-query-history/?a=1&b=2&a=2')
},
gotoOne () {
this.$router.push({ path: '/?a=1&b=2' })
this.historyLength = window.history.length
},
gotoTwo () {
this.$router.push({ path: '/?b=2&a=1' })
this.historyLength = window.history.length
}
}
}).$mount('#app')