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

🐛 [Bug]: 组件schema定义的事件,出码后绑定为 :click,而不是 @click #1147

Closed
hashiqi12138 opened this issue Feb 25, 2025 · 2 comments

Comments

@hashiqi12138
Copy link
Contributor

Environment

chrome

Version

latest

Version

latest

Link to minimal reproduction

Step to reproduce

1、tiny button 定义自定义事件
2、预览出码

{
  "id": 10013,
  "version": "3.22.0",
  "name": {
    "zh_CN": "@TODO"
  },
  "component": "TinyButton",
  "icon": "@TODO",
  "description": "@TODO",
  "doc_url": "",
  "screenshot": "",
  "tags": "",
  "keywords": "",
  "dev_mode": "proCode",
  "npm": {
    "package": "@opentiny/vue",
    "exportName": "Button"
  },
  "group": "@TODO",
  "category": "@TODO",
  "configure": {
    "loop": true,
    "condition": true,
    "styles": true,
    "isContainer": false,
    "isModal": false,
    "isPopper": false,
    "nestingRule": {
      "childWhitelist": "",
      "parentWhitelist": "",
      "descendantBlacklist": "",
      "ancestorWhitelist": ""
    },
    "isNullNode": false,
    "isLayout": false,
    "rootSelector": "",
    "shortcuts": {
      "properties": [
        "autofocus",
        "banner",
        "circle",
        "custom-class",
        "disabled",
        "ghost",
        "href",
        "icon",
        "loading",
        "native-type",
        "plain",
        "reset-time",
        "round",
        "size",
        "text",
        "type"
      ]
    },
    "contextMenu": {
      "actions": [
        "copy",
        "remove",
        "insert",
        "updateAttr",
        "bindEevent",
        "createBlock"
      ],
      "disable": []
    },
    "invalidity": [
      ""
    ],
    "clickCapture": true,
    "framework": "Vue"
  },
  "schema": {
    "properties": [
      {
        "label": {
          "zh_CN": "基础信息"
        },
        "description": {
          "zh_CN": "基础信息"
        },
        "content": [
          {
            "property": "autofocus",
            "type": "boolean",
            "defaultValue": false,
            "label": {
              "text": {
                "zh_CN": "autofocus"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "SwitchConfigurator"
            },
            "description": {
              "zh_CN": "是否默认聚焦",
              "en_US": "Whether to focus by default"
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          },
          {
            "property": "banner",
            "type": "boolean",
            "defaultValue": "",
            "label": {
              "text": {
                "zh_CN": "banner"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "SwitchConfigurator"
            },
            "description": {
              "zh_CN": "设置通栏按钮",
              "en_US": ""
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          },
          {
            "property": "circle",
            "type": "boolean",
            "defaultValue": false,
            "label": {
              "text": {
                "zh_CN": "circle"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "SwitchConfigurator"
            },
            "description": {
              "zh_CN": "是否圆形按钮",
              "en_US": "Round button"
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          },
          {
            "property": "custom-class",
            "type": "string",
            "defaultValue": "",
            "label": {
              "text": {
                "zh_CN": "custom-class"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "InputConfigurator"
            },
            "description": {
              "zh_CN": "设置 custom-class 属性定制按钮样式",
              "en_US": "Set the custom-class attribute to customize the button style"
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          },
          {
            "property": "disabled",
            "type": "boolean",
            "defaultValue": false,
            "label": {
              "text": {
                "zh_CN": "disabled"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "SwitchConfigurator"
            },
            "description": {
              "zh_CN": "是否被禁用按钮",
              "en_US": "Sets whether the button is disabled"
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          },
          {
            "property": "ghost",
            "type": "boolean",
            "defaultValue": false,
            "label": {
              "text": {
                "zh_CN": "ghost"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "SwitchConfigurator"
            },
            "description": {
              "zh_CN": "是否幽灵按钮",
              "en_US": "Is ghost button"
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          },
          {
            "property": "href",
            "type": "string",
            "defaultValue": "",
            "label": {
              "text": {
                "zh_CN": "href"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "InputConfigurator"
            },
            "description": {
              "zh_CN": "通过设置 href 属性可跳转到指定页面",
              "en_US": "Set the href attribute to jump to a specified page"
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          },
          {
            "property": "icon",
            "type": "Component",
            "defaultValue": "",
            "label": {
              "text": {
                "zh_CN": "icon"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "InputConfigurator",
              "props": {}
            },
            "description": {
              "zh_CN": "按钮左侧展示的图标,接收为Icon组件",
              "en_US": "The icon displayed by the button is received as an Icon component"
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          },
          {
            "property": "loading",
            "type": "boolean",
            "defaultValue": false,
            "label": {
              "text": {
                "zh_CN": "loading"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "SwitchConfigurator"
            },
            "description": {
              "zh_CN": "是否加载中状态",
              "en_US": "Loading status"
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          },
          {
            "property": "native-type",
            "type": "'button' | 'submit' | 'reset'",
            "defaultValue": "'button'",
            "label": {
              "text": {
                "zh_CN": "native-type"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "SelectConfigurator",
              "props": {
                "options": [
                  {
                    "label": "button",
                    "value": "button"
                  },
                  {
                    "label": "submit",
                    "value": "submit"
                  },
                  {
                    "label": "reset",
                    "value": "reset"
                  }
                ]
              }
            },
            "description": {
              "zh_CN": "对应按钮原生type属性",
              "en_US": "Set the button native type attribute"
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          },
          {
            "property": "plain",
            "type": "boolean",
            "defaultValue": false,
            "label": {
              "text": {
                "zh_CN": "plain"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "SwitchConfigurator"
            },
            "description": {
              "zh_CN": "是否朴素按钮",
              "en_US": "Simple button"
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          },
          {
            "property": "reset-time",
            "type": "number",
            "defaultValue": 1000,
            "label": {
              "text": {
                "zh_CN": "reset-time"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "InputConfigurator",
              "props": {}
            },
            "description": {
              "zh_CN": "设置按钮禁用时间,防止重复提交,单位毫秒",
              "en_US": "Set the button disable time, in milliseconds, to prevent repeated submission"
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          },
          {
            "property": "round",
            "type": "boolean",
            "defaultValue": false,
            "label": {
              "text": {
                "zh_CN": "round"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "SwitchConfigurator"
            },
            "description": {
              "zh_CN": "是否圆角按钮",
              "en_US": "Whether to round the corner button"
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          },
          {
            "property": "size",
            "type": "'large' | 'medium' | 'small' | 'mini'",
            "defaultValue": "",
            "label": {
              "text": {
                "zh_CN": "size"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "SelectConfigurator",
              "props": {
                "options": [
                  {
                    "label": "large",
                    "value": "large"
                  },
                  {
                    "label": "medium",
                    "value": "medium"
                  },
                  {
                    "label": "small",
                    "value": "small"
                  },
                  {
                    "label": "mini",
                    "value": "mini"
                  }
                ]
              }
            },
            "description": {
              "zh_CN": "定义按钮尺寸",
              "en_US": "Define the button size"
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          },
          {
            "property": "text",
            "type": "string",
            "defaultValue": "",
            "label": {
              "text": {
                "zh_CN": "text"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "InputConfigurator"
            },
            "description": {
              "zh_CN": "按钮显示的文本",
              "en_US": "Set the text displayed by the button"
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          },
          {
            "property": "type",
            "type": "IButtonType",
            "defaultValue": "'default'",
            "label": {
              "text": {
                "zh_CN": "type"
              }
            },
            "required": false,
            "readOnly": false,
            "disabled": false,
            "cols": 12,
            "widget": {
              "component": "SelectConfigurator",
              "props": {
                "options": [
                  {
                    "label": "default",
                    "value": "default"
                  },
                  {
                    "label": "primary",
                    "value": "primary"
                  },
                  {
                    "label": "success",
                    "value": "success"
                  },
                  {
                    "label": "warning",
                    "value": "warning"
                  },
                  {
                    "label": "danger",
                    "value": "danger"
                  },
                  {
                    "label": "info",
                    "value": "info"
                  },
                  {
                    "label": "text",
                    "value": "text"
                  }
                ]
              }
            },
            "description": {
              "zh_CN": "展示按钮不同的状态,设置为text则展示为文本按钮",
              "en_US": "Display different states of buttons, set to text to display as text buttons"
            },
            "labelPosition": "left",
            "rules": [],
            "hidden": false,
            "device": "pc"
          }
        ]
      }
    ],
    "events": {
      "on-click": {
        "label": {
          "zh_CN": "click"
        },
        "description": {
          "zh_CN": "当按钮被点击时触发的回调函数",
          "en_US": "Sets the callback function triggered when a button is clicked"
        },
        "type": "event",
        "functionInfo": {
          "params": [],
          "returns": {}
        },
        "defaultValue": ""
      }
    },
    "slots": {
      "default": {
        "label": {
          "zh_CN": "default"
        },
        "description": {
          "zh_CN": "默认插槽,自定义按钮展示内容",
          "en_US": "Default slot"
        }
      }
    }
  }
}

What is expected

事件正常触发

What is actually happening

事件不触发,出码事件绑定方式不正确

Image

What is your project name

Any additional comments (optional)

No response

@hashiqi12138
Copy link
Contributor Author

事件必须以 on 开头的驼峰式

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


The event must start with on

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