Open huqixing opened 3 years ago
Translation of this issue:
2.15.6
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36
2.6.14
If components such as El input are used in HTML, errors will be reported in other codes that have used the callback attribute
For example: HTML:
< El input class = \"logininput\" type = \"text\" clear = true V-model = \"username\" placeholder = \"please enter username\" > < / El input > javastrap:
var data = { name: \"name\",
callback: function (response) { console.log(response)
} }
When running, the callback attribute error prompt will appear
I understand that the callback scope is different and should not lead to this problem. In the example, the callback is only one attribute in the object
In fact, callback affects the global, which means that this variable cannot be used in all places except the element component
Element UI version
2.15.6
OS/Browsers version
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36
Vue version
2.6.14
Reproduction Link
https://jsfiddle.net/aaaaa/
Steps to reproduce
如果在html中使用了el-input等组件,那将会导致其他位置使用过callback属性的代码都报错 例如: HTML:
javastrap: var data = { name: "name", callback: function (response) { console.log(response) } } 在运行时,会出现callback属性错误提示
What is Expected?
我理解的callback作用域不一样,应该不会导致这种问题。 在示例中的callback仅为对象里面的一个属性
What is actually happening?
实际上callback影响了全局,代表全局所有除开Element组件之外的地方将无法使用这个变量