Skip to content

[TagInput] 在onBlur事件中获取的inputvalu永远为空? #3324

@chenkang-noob

Description

@chenkang-noob

tdesign-react 版本

1.10.4

重现链接

https://knwmhswzrun-2lcb--5173--a792378e.local-credentialless.webcontainer.io

重现步骤

import React, { useState } from 'react';
import { TagInput, Space } from 'tdesign-react';
import type { TagInputProps, TagInputValue } from 'tdesign-react';

export default function TagInputBaseExample() {
const [tags1, setTags1] = useState([
'Vue',
'React',
'Angular',
]);
const [tags2] = useState(['Vue', 'React']);
const [tags3] = useState(['Vue', 'React']);

const onTagInputEnter: TagInputProps['onEnter'] = (val, context) => {
console.log(val, context);
};

const onChange: TagInputProps['onChange'] = (val, context) => {
console.log(val, context);
setTags1(val);
};

const onPaste: TagInputProps['onPaste'] = (context) => {
console.log(context);
};
const onBlur = (value, context: { inputValue: string; e: FocusEvent }) => {
console.log('onBlur =====>', value, 'ctx:', context);
};

return (

);
}

在输入后点击组件外其他地方,获取的context.inputvalue永远为""

期望结果

能获取输入的值?

实际结果

没获取输入的值

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    to be publishedfixed, not be published🐞 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions