保誠-保戶業務員媒合平台
Tomas
2021-12-22 abfd26bb700d93a92da6a04703b0187d4acaaeb5
PAMapp/components/Ui/UiPagination.vue
@@ -12,20 +12,20 @@
<script lang="ts">
import { Vue, Component, Prop, Emit, Watch } from 'nuxt-property-decorator';
import { Consultants } from '~/assets/ts/api/consultant';
import { Consultant } from '~/shared/models/consultant.model';
@Component
export default class UiPagination extends Vue {
    @Prop() totalList!: Consultants[];
    pageSize = 5;
    @Prop() totalList!: Consultant[];
    @Prop({default: 5}) pageSize!: number;
    currentPage = 1;
    pageList: Consultants[] = [];
    pageList: Consultant[] = [];
    mounted() {
        this.handleCurrentChange(this.currentPage);
    }
    @Emit('changePage') chagnePage(): Consultants[] {
    @Emit('changePage') changePage(): Consultant[] {
        return this.pageList
    }
@@ -37,14 +37,14 @@
        if (this.totalList) {
            this.pageList = this.totalList.slice(this.pageSize * currentPage - this.pageSize, this.pageSize * currentPage)
            this.chagnePage();
            this.changePage();
        }
    }
    @Watch('totalList') watchtotalList(newValue: Consultants[]) {
    @Watch('totalList') watchTotalList(newValue: Consultant[]) {
        if (newValue) {
            this.handleCurrentChange(this.currentPage);
        }
    }
}
</script>
</script>