From 873bb61290fadf81f3ebbe0bab04bb1b0cc82013 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期二, 04 一月 2022 17:24:31 +0800 Subject: [PATCH] Update:保戶個人帳號設定 增加成功提醒popup --- PAMapp/components/Ui/UiPagination.vue | 47 +++++++++++++++++++++++++++++------------------ 1 files changed, 29 insertions(+), 18 deletions(-) diff --git a/PAMapp/components/Ui/UiPagination.vue b/PAMapp/components/Ui/UiPagination.vue index 4e795bf..2e13b2b 100644 --- a/PAMapp/components/Ui/UiPagination.vue +++ b/PAMapp/components/Ui/UiPagination.vue @@ -1,6 +1,6 @@ <template> <el-pagination - :current-page.sync="currentPage" + :current-page.sync="syncCurrentPage" layout="prev, pager, next" :total="totalList.length" :page-size="pageSize" @@ -11,23 +11,40 @@ </template> <script lang="ts"> -import { Vue, Component, Prop, Emit, Watch } from 'nuxt-property-decorator'; -import { Consultants } from '~/assets/ts/api/consultant'; +import { Vue, Component, Prop, Emit, Watch, PropSync } from 'nuxt-property-decorator'; +import { Consultant } from '~/shared/models/consultant.model'; @Component export default class UiPagination extends Vue { - @Prop() totalList!: Consultants[]; + @Prop() + totalList!: Consultant[]; + @Prop({default: 5}) pageSize!: number; - currentPage = 1; - pageList: Consultants[] = []; + @PropSync('currentPage', {default: 1}) syncCurrentPage!: number; - mounted() { - this.handleCurrentChange(this.currentPage); - } + pageList: Consultant[] = []; - @Emit('changePage') chagnePage(): Consultants[] { + ////////////////////////////////////////////////////////////////// + + @Emit('changePage') + changePage(): Consultant[] { return this.pageList } + + @Watch('totalList') + watchTotalList(newValue: Consultant[]) { + if (newValue) { + this.handleCurrentChange(this.syncCurrentPage); + } + } + + ////////////////////////////////////////////////////////////////// + + mounted() { + this.handleCurrentChange(this.syncCurrentPage); + } + + ////////////////////////////////////////////////////////////////// handleCurrentChange(currentPage: number) { @@ -37,14 +54,8 @@ if (this.totalList) { this.pageList = this.totalList.slice(this.pageSize * currentPage - this.pageSize, this.pageSize * currentPage) - this.chagnePage(); - } - } - - @Watch('totalList') watchtotalList(newValue: Consultants[]) { - if (newValue) { - this.handleCurrentChange(this.currentPage); + this.changePage(); } } } -</script> \ No newline at end of file +</script> -- Gitblit v1.8.0