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

文本框回车会影响按钮的点击事件??? #409

Open
stevensy opened this issue Sep 22, 2021 · 2 comments
Open

文本框回车会影响按钮的点击事件??? #409

stevensy opened this issue Sep 22, 2021 · 2 comments

Comments

@stevensy
Copy link

stevensy commented Sep 22, 2021

版本号 (version) : @form-create/[email protected]
UI 框架的版本 (UI version) :2.15.6

一个表单里有一个文本框和一个按钮,在文本框中回车之后影响到了按钮的点击事件

view:
<form-create v-model="api" :rule="rules" :option="option" />
rules如下:

        {
          "type": "input",
          "title": "姓名",
          "field": "sellerName",
          "hidden": false,
          "style": {
            "width": "100%"
          },
          "validate": [{
            "required": true,
            "message": "请输入姓名",
            "trigger": "blur",
          }, {
            "pattern": /^([\u4e00-\u9fa5]{2,25}$)|^([a-zA-Z]+(\s+[a-zA-Z]+)*$)/,
            "message": "格式有误,请重新输入"
          }],
          "col": {
            "span": 8
          },
          "props": {
            "type": "text",
            "placeholder": "请输入姓名",
            "maxlength": "25",
            "showWordLimit": false,
            "clearable": true,
            "readonly": false,
            "disabled": false,
            "prefixIcon": "",
            "suffixIcon": ""
          }
        },  {
          "type": "el-button",
          "field": "addAgent",
          "on": {
            "click": function click(e) {
              console.log('文本框的回车事件怎么也触发了???', e)
              if (e.pointerId ===-1) return // (暂时的解决方案)
              console.log('正常按钮的事件', e)
            }
          },
          "children": ["添加代理人"],
          "col": {
            "labelWidth": "0px"
          },
          "props": {
            "type": "primary",
            "disabled": false,
            "size": "medium"
          }
        }
      ]

image

@xaboy
Copy link
Owner

xaboy commented Sep 22, 2021

这个问题确实有点奇怪, 我目前没找见原因. 我这边在检查一下

@stevensy
Copy link
Author

支持大佬,点赞

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