mirror of https://gitee.com/answerdev/answer.git
fix: only write or edit content show required tag text
This commit is contained in:
parent
974e4c75be
commit
34f4c072dd
|
@ -507,6 +507,7 @@ ui:
|
|||
search_tag: Search tag
|
||||
hint: "Describe what your question is about, at least one tag is required."
|
||||
no_result: No tags matched
|
||||
tag_required_text: Required tag (at least one)
|
||||
header:
|
||||
nav:
|
||||
question: Questions
|
||||
|
|
|
@ -19,6 +19,7 @@ interface IProps {
|
|||
onBlur?: () => void;
|
||||
hiddenDescription?: boolean;
|
||||
hiddenCreateBtn?: boolean;
|
||||
showRequiredTagText?: boolean;
|
||||
alwaysShowAddBtn?: boolean;
|
||||
}
|
||||
|
||||
|
@ -32,6 +33,7 @@ const TagSelector: FC<IProps> = ({
|
|||
hiddenDescription = false,
|
||||
hiddenCreateBtn = false,
|
||||
alwaysShowAddBtn = false,
|
||||
showRequiredTagText = false,
|
||||
}) => {
|
||||
const [initialValue, setInitialValue] = useState<Type.Tag[]>([...value]);
|
||||
const [currentIndex, setCurrentIndex] = useState<number>(0);
|
||||
|
@ -224,12 +226,14 @@ const TagSelector: FC<IProps> = ({
|
|||
</Form>
|
||||
</Dropdown.Header>
|
||||
)}
|
||||
{tags && tags.filter((v) => v.recommend)?.length > 0 && (
|
||||
{showRequiredTagText &&
|
||||
tags &&
|
||||
tags.filter((v) => v.recommend)?.length > 0 && (
|
||||
<Dropdown.Item
|
||||
disabled
|
||||
style={{ fontWeight: 500 }}
|
||||
className="text-secondary">
|
||||
Required tag (at least one)
|
||||
{t('tag_required_text')}
|
||||
</Dropdown.Item>
|
||||
)}
|
||||
|
||||
|
|
|
@ -348,6 +348,7 @@ const Ask = () => {
|
|||
<TagSelector
|
||||
value={formData.tags.value}
|
||||
onChange={handleTagsChange}
|
||||
showRequiredTagText
|
||||
/>
|
||||
<Form.Control.Feedback type="invalid">
|
||||
{formData.tags.errorMsg}
|
||||
|
|
Loading…
Reference in New Issue