商家端列表页缓存

This commit is contained in:
mabo
2021-07-31 15:49:54 +08:00
parent ad17d8b743
commit 8cec0e6ab8
30 changed files with 279 additions and 493 deletions

View File

@@ -29,10 +29,9 @@
<template slot-scope="{ row }" slot="action">
<Button v-if="row.promotionStatus === 'NEW' || row.promotionStatus === 'CLOSE'" type="info" size="small" :style="{'marginRight': row.promotionStatus !== 'CLOSE'?'5px':'0'}" @click="edit(row)">编辑</Button>
<Button v-if="row.promotionStatus !== 'CLOSE'" type="error" size="small" @click="remove(row)">下架</Button>
<!-- <Button v-if="row.promotionStatus === 'CLOSE' || row.promotionStatus === 'NEW'" type="success" size="small" @click="open(row)">上架</Button> -->
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
size="small" show-total show-elevator show-sizer></Page>
</Row>
@@ -337,7 +336,7 @@ export default {
});
},
},
activated() {
mounted() {
this.init();
},
};

View File

@@ -296,8 +296,13 @@ export default {
});
},
},
activated () {
mounted () {
this.init();
},
// 页面缓存处理从该页面离开时修改KeepAlive为false保证进入该页面是刷新
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false
next()
}
};
</script>

View File

@@ -25,7 +25,7 @@
</Tabs>
<Table :columns="liveColumns" :data="liveData"></Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePageNumber" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
size="small" show-total show-elevator show-sizer></Page>
</Row>

View File

@@ -98,7 +98,7 @@
</div>
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page
:current="searchForm.pageNumber + 1"
:total="total"
@@ -329,9 +329,14 @@ export default {
});
},
},
activated() {
mounted() {
this.init();
},
// 页面缓存处理从该页面离开时修改KeepAlive为false保证进入该页面是刷新
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false
next()
}
};
</script>
<style lang="scss">

View File

@@ -285,6 +285,13 @@ export default {
mounted () {
this.init();
},
// 如果是从详情页返回列表页修改列表页keepAlive为true确保不刷新页面
beforeRouteLeave(to, from, next){
if(to.name === 'pintuan') {
to.meta.keepAlive = true
}
next()
}
};
</script>
<style lang="scss" scoped>

View File

@@ -56,7 +56,7 @@
>
</template>
</Table>
<Row type="flex" justify="end" class="page">
<Row type="flex" justify="end" class="mt_10">
<Page :current="searchForm.pageNumber + 1" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
size="small" show-total show-elevator show-sizer></Page>
</Row>
@@ -206,8 +206,13 @@ export default {
return hourArr;
},
},
activated() {
mounted() {
this.init();
},
// 页面缓存处理从该页面离开时修改KeepAlive为false保证进入该页面是刷新
beforeRouteLeave(to, from, next) {
from.meta.keepAlive = false
next()
}
};
</script>
@@ -223,11 +228,5 @@ export default {
.select-clear {
margin-left: 10px;
}
.page {
margin-top: 2vh;
}
.drop-down {
margin-left: 5px;
}
}
</style>

View File

@@ -395,6 +395,13 @@ export default {
mounted() {
this.init();
},
// 如果是从详情页返回列表页修改列表页keepAlive为true确保不刷新页面
beforeRouteLeave(to, from, next){
if(to.name === 'seckill') {
to.meta.keepAlive = true
}
next()
}
};
</script>
<style lang="scss" scoped>