首页 > 解决方案 > 无法在 Surveyjs 的 Markdown Radiogroup 中的“其他(描述)”复选框中添加 svg 图标

问题描述

questions: [
{
"type": "radiogroup",
"hasOther": true,
"isRequired": true,
"name": "favoritePet",
"title": "What is your favorite pet ![A parrot](https://surveyjs.io/Content/Images/examples/markdown/image_16x16.svg =16x16) ?",
"choices": [
{
"value": "dog",
"text": "Dog: ![A dog](https://surveyjs.io/Content/Images/examples/markdown/dog.svg =14x14)"
}, {
"value": "cat",
"text": "Cat: ![A cat](https://surveyjs.io/Content/Images/examples/markdown/cat.svg =14x14)"
}, {
"value": "parrot",
"text": "Parrot ![A parrot](https://surveyjs.io/Content/Images/examples/markdown/parrot.svg =14x14)"
}
]
}
]

无法在 hasOther 中添加图标,在文档中它显示了选项中显示的图标,但未显示如何在其他(描述)选项中添加图标。 https://www.surveyjs.io/Examples/Library/?id=survey-markdown-radiogroup

标签: surveyjs

解决方案


您需要设置otherText属性:

{
            "type": "radiogroup",
            "hasOther": true,
            "isRequired": true,
            "name": "favoritePet",
            "otherText": "Custom other text with an image ![A parrot](https://surveyjs.io/Content/Images/examples/markdown/image_16x16.svg =16x16)",
            "title": "What is your favorite pet ![A parrot](https://surveyjs.io/Content/Images/examples/markdown/image_16x16.svg =16x16) ?",
            "choices": [
                {
                    "value": "dog",
                    "text": "Dog: ![A dog](https://surveyjs.io/Content/Images/examples/markdown/dog.svg =14x14)"
                }, {
                    "value": "cat",
                    "text": "Cat: ![A cat](https://surveyjs.io/Content/Images/examples/markdown/cat.svg =14x14)"
                }, {
                    "value": "parrot",
                    "text": "Parrot ![A parrot](https://surveyjs.io/Content/Images/examples/markdown/parrot.svg =14x14)"
                }
            ]
        }

这是工作 plunker 示例 - https://plnkr.co/edit/9LgRCEpWr2b8LGU1


推荐阅读