0👍
you need to use computed. if you don’t know anything about this; let me give you an example:
new Vue({
el: '#app',
props: {
current: {
type: Number,
default: 1
}
},
computed: {
next() {
return this.current + 1
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
{{current}}
|
{{next}}
</div>
if you need get current page from route:
new Vue({
el: '#app',
computed: {
current() {
return this.$route.params.page
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">{{current}}</div>
Source:stackexchange.com