mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-24 23:49:14 +08:00
[bugfix] PullRefresh: ensure value change can be watched (#3719)
This commit is contained in:
parent
5d5bc878d0
commit
5b4a4cc078
@ -99,10 +99,15 @@ export default createComponent({
|
||||
onTouchEnd() {
|
||||
if (!this.untouchable && this.ceiling && this.deltaY) {
|
||||
this.duration = this.animationDuration;
|
||||
|
||||
if (this.status === 'loosing') {
|
||||
this.setStatus(this.headHeight, true);
|
||||
this.$emit('input', true);
|
||||
this.$emit('refresh');
|
||||
|
||||
// ensure value change can be watched
|
||||
this.$nextTick(() => {
|
||||
this.$emit('refresh');
|
||||
});
|
||||
} else {
|
||||
this.setStatus(0);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import PullRefresh from '..';
|
||||
import { mount, trigger, triggerDrag } from '../../../test/utils';
|
||||
import { mount, later, trigger, triggerDrag } from '../../../test/utils';
|
||||
|
||||
test('change head content when pulling down', () => {
|
||||
test('change head content when pulling down', async () => {
|
||||
const wrapper = mount(PullRefresh, {
|
||||
propsData: {
|
||||
value: false
|
||||
@ -32,6 +32,9 @@ test('change head content when pulling down', () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
|
||||
expect(wrapper.emitted('input')).toBeTruthy();
|
||||
expect(wrapper.emitted('refresh')).toBeFalsy();
|
||||
|
||||
await later();
|
||||
expect(wrapper.emitted('refresh')).toBeTruthy();
|
||||
|
||||
// end loading
|
||||
|
Loading…
x
Reference in New Issue
Block a user