Commit 4af97d30 authored by Evan You's avatar Evan You

fix state

parent 530a486c
...@@ -24,8 +24,6 @@ import Spinner from './Spinner.vue' ...@@ -24,8 +24,6 @@ import Spinner from './Spinner.vue'
import Item from './Item.vue' import Item from './Item.vue'
import { watchList } from '../store/api' import { watchList } from '../store/api'
let isInitialRender = true
export default { export default {
name: 'item-list', name: 'item-list',
...@@ -39,18 +37,12 @@ export default { ...@@ -39,18 +37,12 @@ export default {
}, },
data () { data () {
const data = { return {
loading: false, loading: false,
transition: 'slide-up', transition: 'slide-up',
// if this is the initial render, directly render with the store state displayedPage: Number(this.$store.state.route.params.page) || 1,
// otherwise this is a page switch, start with blank and wait for data load. displayedItems: this.$store.getters.activeItems
// we need these local state so that we can precisely control the timing
// of the transitions.
displayedPage: isInitialRender ? Number(this.$store.state.route.params.page) || 1 : -1,
displayedItems: isInitialRender ? this.$store.getters.activeItems : []
} }
isInitialRender = false
return data
}, },
computed: { computed: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment