// css 样式依赖common.css const pagination = { inheritAttrs: false, template: `
{{lang.total}} {{pageData.total}} {{lang.pieces}}
{{lang.prev_page}} {{lang.next_page}}
`, data () { return {}; }, computed: { layoutToUse () { return this.$attrs.layout || "slot, sizes, prev, pager,jumper, next"; }, isNextPageDisabled () { return this.curPageLength < this.pageData.limit; }, }, props: { pageData: { default: function () { return { page: 1, pageSizes: [20, 50, 100], limit: 20, total: 400, }; }, }, showCustomButtons: { type: Boolean, default: false, }, curPageLength: { type: Number, default: 0, } }, methods: { handleChange (direction) { if (direction === 0) { if (this.pageData.page > 1) { this.pageData.page -= 1; this.$emit('currentchange', this.pageData.page); } } else if (direction === 1) { if (!this.isNextPageDisabled) { this.pageData.page += 1; this.$emit('currentchange', this.pageData.page); } } }, handleSizeChange (e) { this.pageData.limit = e; this.$emit("sizechange", e); }, handleCurrentChange (e) { this.pageData.page = e; this.$emit("currentchange", e); }, }, };