【发布时间】:2026-01-29 09:10:01
【问题描述】:
我在“mpowaga:autoform-summernote”中安装了“summernote:summernote”。在 Summernote 编辑器中输入的数据使用“SimpleSchema”形式写入数据集合中:
content: {
type: String,
label: "Treść wydarzenia",
autoform: {
afFieldInput: {
type: 'summernote',
class: 'editor',
placeholder: 'Please add content...',
settings:{
height: 150
}
}
}
},
这是数据库中给出的例子:
"content" : "<div>Beginning with AutoForm 4.0, there is advanced support for input types, including the ability to easily add custom input types (AKA form controls or \"widgets\"). An input type definition is essentially just a small template containing the markup plus a function that tells AutoForm how to obtain an input value from that template.</div><div><br></div><div>By default, AutoForm still automatically selects an appropriate input type based on examining the schema for each field. To override that behavior and choose your own type, you only need to add the `type` attribute to your `afFieldInput` component, or to a component that wraps an `afFieldInput` (such as `afFormGroup` or `afQuickField`), or to the `autoform` object in your schema for the field.</div><div><br></div><div>Select an input type to see all the different ways in which that type can be used in your form. Select a schema type, open your browser console, enter a value, and click Submit to see how the value of the field is converted to the proper type requested by the schema.</div>"
如何读取数据集合的数据“内容”,以便将包含的内容显示为 HTML 而不是文本。
【问题讨论】:
-
使用
html标签和属性插入数据。如果你想呈现为 html,你不需要做任何事情。 -
烘焙这样的代码后:
{{wydarzenie.content}}
在模板中在浏览器中收到这样的结果:"
从AutoForm 4.0开始,对输入类型有高级支持,包括轻松添加自定义输入类型(又名控件形式或“小部件”)的能力。...“ -
对 html 使用三重花括号 -
{{{wydarzenie.content}}} -
感谢您的帮助。
标签: javascript meteor meteor-blaze