소스 검색

fix(button): 为按钮添加type属性防止表单提交意外触发表单验证机制 (#6340)

在按钮组件中,按钮元素缺少type="button"属性可能导致在表单中意外提交。添加此属性以确保按钮行为符合预期。

Co-authored-by: yuanwj <ywj6792341@qq.com>
XiaoHetitu 3 달 전
부모
커밋
8ba7bdf2bd
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      packages/@core/ui-kit/shadcn-ui/src/components/button/check-button-group.vue

+ 1 - 0
packages/@core/ui-kit/shadcn-ui/src/components/button/check-button-group.vue

@@ -122,6 +122,7 @@ async function onBtnClick(value: ValueType) {
       v-bind="btnDefaultProps"
       :variant="innerValue.includes(btn.value) ? 'default' : 'outline'"
       @click="onBtnClick(btn.value)"
+      type="button"
     >
       <div class="icon-wrapper" v-if="props.showIcon">
         <slot