Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

监听change事件会触发其他组件的click事件 #701

Open
big-code-pi opened this issue May 18, 2024 · 1 comment
Open

监听change事件会触发其他组件的click事件 #701

big-code-pi opened this issue May 18, 2024 · 1 comment

Comments

@big-code-pi
Copy link

版本号 : "@form-create/element-ui": "^2.5.7"
element-ui 框架的版本: 2.15.6
问题如下:
// 组件传参

// 生成规则
hform: {
fApi: null,
rule: [{
type: 'input',
field: 'name',
value: '',
props: {
placeholder: '请输入名称',
suffixIcon: 'el-icon-search'
},
on: {
change: () => {
console.log('input的change事件')
}
}
}, {
type: 'button',
props: {
type: 'primary',
size: 'small',
icon: 'el-icon-download'
},
on: {
click: () => {
console.log('按钮的click')
}
},
children: ['导 出']
}],
option: {
submitBtn: false,
form: {
size: 'small',
inline: true
}}
}

描述: 配置生成了一个输入框和一个按钮 , 当在输入框内输入内容后点击键盘enter键会同时触发按钮的click事件 ,如上代码中控制台会打印 'input的change事件' 和 '按钮的click' ,请问如何规避这种情况?

@xaboy
Copy link
Owner

xaboy commented Jun 3, 2024

这个问题很奇怪,我在vue2中复现了,但是vue3中测试又好着. 目前还不清楚触发的原因 @big-code-pi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants