|
@@ -35,7 +35,7 @@
|
|
</template>
|
|
</template>
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
import { Component, Vue } from 'vue-property-decorator'
|
|
import { Component, Vue } from 'vue-property-decorator'
|
|
-import { mapActions } from 'vuex'
|
|
|
|
|
|
+import { mapState, mapMutations, mapActions } from 'vuex'
|
|
import { List } from 'vant'
|
|
import { List } from 'vant'
|
|
import Empty from '@/components/common/Empty.vue'
|
|
import Empty from '@/components/common/Empty.vue'
|
|
@Component({
|
|
@Component({
|
|
@@ -45,6 +45,12 @@ import Empty from '@/components/common/Empty.vue'
|
|
Empty
|
|
Empty
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ ...mapState('home', {
|
|
|
|
+ reportList: (state: any) => state.reportList
|
|
|
|
+ }),
|
|
|
|
+ ...mapMutations({
|
|
|
|
+ saveList: 'home/saveReportList'
|
|
|
|
+ }),
|
|
...mapActions({
|
|
...mapActions({
|
|
getList: 'home/getReportList'
|
|
getList: 'home/getReportList'
|
|
})
|
|
})
|
|
@@ -52,7 +58,9 @@ import Empty from '@/components/common/Empty.vue'
|
|
})
|
|
})
|
|
|
|
|
|
export default class Home extends Vue {
|
|
export default class Home extends Vue {
|
|
|
|
+ protected reportList!: any
|
|
protected getList!: any
|
|
protected getList!: any
|
|
|
|
+ protected saveList!: any
|
|
listState = {
|
|
listState = {
|
|
list: [],
|
|
list: [],
|
|
loading: false,
|
|
loading: false,
|
|
@@ -63,7 +71,6 @@ export default class Home extends Vue {
|
|
}
|
|
}
|
|
|
|
|
|
beforeRouteEnter (to, from, next) {
|
|
beforeRouteEnter (to, from, next) {
|
|
- console.log(to, from)
|
|
|
|
if (from.name === 'detail') {
|
|
if (from.name === 'detail') {
|
|
to.meta.isBack = true
|
|
to.meta.isBack = true
|
|
} else {
|
|
} else {
|
|
@@ -72,10 +79,6 @@ export default class Home extends Vue {
|
|
next()
|
|
next()
|
|
}
|
|
}
|
|
|
|
|
|
- created () {
|
|
|
|
- // this.getReportList()
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
activated () {
|
|
activated () {
|
|
if (!this.$route.meta.isBack) {
|
|
if (!this.$route.meta.isBack) {
|
|
this.listState = {
|
|
this.listState = {
|
|
@@ -87,14 +90,18 @@ export default class Home extends Vue {
|
|
scroll: 0
|
|
scroll: 0
|
|
}
|
|
}
|
|
this.getReportList()
|
|
this.getReportList()
|
|
|
|
+ return
|
|
}
|
|
}
|
|
this.$route.meta.isBack = false
|
|
this.$route.meta.isBack = false
|
|
- ;(this.$refs.wrapper as any).scrollTop = this.listState.scroll
|
|
|
|
|
|
+ this.listState = this.reportList()
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ ;(this.$refs.wrapper as any).scrollTop = this.reportList().scroll
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
beforeRouteLeave (to, form, next) {
|
|
beforeRouteLeave (to, form, next) {
|
|
- console.log((this.$refs.wrapper as any).scrollTop)
|
|
|
|
this.listState.scroll = (this.$refs.wrapper as any).scrollTop
|
|
this.listState.scroll = (this.$refs.wrapper as any).scrollTop
|
|
|
|
+ this.saveList(this.listState)
|
|
next()
|
|
next()
|
|
}
|
|
}
|
|
|
|
|