form-create icon indicating copy to clipboard operation
form-create copied to clipboard

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

Open stevensy opened this issue 4 years ago • 2 comments

版本号 (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

stevensy avatar Sep 22 '21 02:09 stevensy

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

xaboy avatar Sep 22 '21 02:09 xaboy

支持大佬,点赞

stevensy avatar Sep 22 '21 03:09 stevensy