diff --git a/devui/tag-input/src/tag-input.tsx b/devui/tag-input/src/tag-input.tsx index 8ed491cbe549f9e6518decf9d53e49d6fa5abcd4..192d180bc501692017a0bab9aaddc21ee780891f 100644 --- a/devui/tag-input/src/tag-input.tsx +++ b/devui/tag-input/src/tag-input.tsx @@ -137,6 +137,10 @@ export default defineComponent({ mergedSuggestions.value.length === 0 && (tagInputVal.value = ''); }; const onInputKeydown = ($event: KeyboardEvent) => { + if (!tagInputVal.value) { + return; + } + switch ($event.key) { case KEYS_MAP.tab: case KEYS_MAP.enter: diff --git a/docs/components/tag-input/index.md b/docs/components/tag-input/index.md index 80bd047cb149732bdff969239b4df514a74174a6..bc04caa9a4c1f06ee37a23896d9348d05905812a 100644 --- a/docs/components/tag-input/index.md +++ b/docs/components/tag-input/index.md @@ -9,12 +9,13 @@ ### 基本用法 +v-model:tags="state.tags" +v-model:suggestionList="state.suggestionList" +display-property="name" +placeholder="请输入名字" +no-data="暂无数据" + +> ```html \ No newline at end of file + + +::: + +### d-tags-input + +| 参数 | 类型 | 默认值 | 说明 | +| --------------- | --------- | ------------------------- | ------------------------------------ | +| tags | `Array` | [] | 必选,记录输入的标签和选择的标签列表 | +| displayProperty | `String` | `name` | 可选,列表项使用的属性名 | +| placeholder | `Boolean` | | 可选,输入框的 placeholder | +| maxTags | `Number` | `Number.MAX_SAFE_INTEGER` | 可选,输入标签内容的最大长度 | +| maxTagsText | `String` | | 可选,- | +| spellcheck | `Boolean` | true | 可选,input 输入框是否开启拼写检查的 | +| suggestionList | `Array` | [] | 可选,下拉选项,默认可选择的标签列表 | +| disabled | `Boolean` | false | 是否禁用 | +| disabledText | `String` | | 可选,- | +| noData | `String` | | 可选,- | + +### d-tags-input 事件 + +| 参数 | 类型 | 说明 | +| ----------- | ------------------- | -------------------------------------------------------- | +| valueChange | `EventEmitter` | 当选中某个选项项后,将会调用此函数,参数为当前选择项的值 |