mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(Field): should not display null (#6542)
This commit is contained in:
parent
4b786cdba3
commit
700a0f23f7
@ -280,7 +280,7 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
updateValue(value) {
|
updateValue(value) {
|
||||||
value = String(value);
|
value = isDef(value) ? String(value) : '';
|
||||||
|
|
||||||
if (value === this.currentValue) {
|
if (value === this.currentValue) {
|
||||||
return;
|
return;
|
||||||
|
@ -380,3 +380,14 @@ test('should blur search input on enter', () => {
|
|||||||
wrapper.find('input').trigger('keypress.enter');
|
wrapper.find('input').trigger('keypress.enter');
|
||||||
expect(wrapper.emitted('blur')).toBeTruthy();
|
expect(wrapper.emitted('blur')).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('value is null', () => {
|
||||||
|
const wrapper = mount(Field, {
|
||||||
|
propsData: {
|
||||||
|
value: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(wrapper.find('input').element.value).toEqual('');
|
||||||
|
expect(wrapper.emitted('input')[0][0]).toEqual('');
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user