element [bug report] auto complete bug

klsxnrf1  于 5个月前  发布在  其他
关注(0)|答案(4)|浏览(97)

Element UI version

2.13.1

OS/Browsers version

windows 10, chrome 78

Vue version

2.6.11

github

Steps to reproduce

https://element.eleme.cn/#/zh-CN/component/input,
文档页找到Input的带输入建议框的框处,点击Input输入框,随意输入几个字符,然后点击输入框以外的地方,使输入框失去焦点

What is Expected?

无任何行为

What is actually happening?

报错,代码定位为autocompelete.vue 第201行,错误信息为:vue.runtime.esm.js?2b0e:1888 TypeError: Cannot read property 'value' of undefined
handleChange(event) {
this.$emit('change', event.target.value); //此处发生了错误
},

经console.log(event)的值,发现其为一个String对象,和输入框中的内容相同。又经追踪,handleChange由事件Input的change事件触发,而Input的change定义为(摘自element-ui文档):"change 在 Input 值改变时触发 (value: string | number)",handleChange的代码是否应该是下面这样?
handleChange(value) {
this.$emit("change", value);
}

z6psavjg

z6psavjg1#

Translation of this issue:

Element UI version

2.13.1

OS/Browsers version

windows 10, chrome 78

Vue version

2.6.11

github

Steps to reproduce

https://element.eleme.cn/#/zh-CN/component/input,

On the document page, find the input box with input suggestion box, click the input box, input a few characters at will, and then click outside the input box to make the input box lose focus

What is Expected?

No action

What is actually happening?

Error is reported. The code is located at line 201 of autocomperate.vue. The error message is: vue.runtime.esm.js? 2b0e: 1888 typeerror: cannot read property 'value' of undefined
handleChange(event) {

This. $exit ('change ', event. Target. Value); / / an error occurred here
}

Through the value of console.log (event), it is found that it is a string object, which is the same as the content in the input box. After tracing, handlechange is triggered by the change event of the event input, and the change of input is defined as (extracted from the element UI document): "change is triggered when the input value changes (value: string| number)". Should the code of handlechange be as follows?
handleChange(value) {

this.$emit("change", value);
}

kzmpq1sx

kzmpq1sx2#

Hi @oohacker I had the same problem then realised this has been fixed in the latest version (2.13.2)
#19200

brjng4g3

brjng4g34#

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

相关问题