首页 > 解决方案 > 为 AddTextInput 启用多行

问题描述

我正在为 Grafana 编写自己的插件,我想显示多行(即行),addTextInput以便我可以在文本框中编写文本段落(即像 grafana 自己的文本插件的内容输入)。默认情况下,addTextInput 只有一行。这应该很简单,但不知何故我在文档中找不到该功能。有谁知道该怎么做?

module.ts 中

return builder
    .addTextInput({
        path: 'myText',
        name: 'This is supposed to be a multiple line input',
        defaultValue: '',
    })
});

标签: grafana

解决方案


经过数小时的谷歌搜索和查看其他人的源代码后,我终于找到了答案。这是在文本输入上启用多行的方法:

return builder
    .addTextInput({
        path: 'myText',
        name: 'This is supposed to be a multiple line input',
        defaultValue: '',
        settings: {
            useTextarea:true,
            rows: 5,
        }
    })
});

我不确定为什么文档中没有记录。


推荐阅读