mirror of https://github.com/ElemeFE/element
Pagination: emit current-change after current page is manually updated (#11012)
parent
d304cb27cf
commit
7409be8ce1
|
@ -408,6 +408,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.$emit('update:currentPage', newVal);
|
this.$emit('update:currentPage', newVal);
|
||||||
}
|
}
|
||||||
|
this.lastEmittedPage = -1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -306,6 +306,38 @@ describe('Pagination', () => {
|
||||||
}, 50);
|
}, 50);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('event:current-change after current page is manually updated', (done) => {
|
||||||
|
vm = createVue({
|
||||||
|
template: `
|
||||||
|
<el-pagination
|
||||||
|
:total="15"
|
||||||
|
:current-page.sync="currentPage"
|
||||||
|
@current-change="emitCount++" />
|
||||||
|
`,
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
emitCount: 0,
|
||||||
|
currentPage: 1
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const next = vm.$el.querySelector('button.btn-next');
|
||||||
|
next.click();
|
||||||
|
setTimeout(() => {
|
||||||
|
expect(vm.emitCount).to.equal(1);
|
||||||
|
vm.currentPage = 1;
|
||||||
|
setTimeout(() => {
|
||||||
|
expect(vm.emitCount).to.equal(1);
|
||||||
|
next.click();
|
||||||
|
setTimeout(() => {
|
||||||
|
expect(vm.emitCount).to.equal(2);
|
||||||
|
done();
|
||||||
|
}, 50);
|
||||||
|
}, 50);
|
||||||
|
}, 50);
|
||||||
|
});
|
||||||
|
|
||||||
it('event:size-change', done => {
|
it('event:size-change', done => {
|
||||||
vm = createVue({
|
vm = createVue({
|
||||||
template: `
|
template: `
|
||||||
|
|
Loading…
Reference in New Issue