我想知道如何将 html 标签放入 $ 文本中,如下所示:
ಠᴥಠ = {
$cell: true,
id: "widget",
$text: 'This is <b>widget</b>',
$init: function(){
alert('widget ready');
}
}
它不会提供良好的输出,无论如何有更好的方法吗?
PD:我无法创建需要至少 1500 声誉的新标签“cell.js”。
最佳答案
对于简单的事情,例如在文本中添加粗体标记或斜体标记,您可以使用 $html
:
ಠᴥಠ = {
$cell: true,
id: "widget",
$html: 'This is <b>widget</b>',
$init: function(){
alert('widget ready');
}
}
当然,如果您想要比这更复杂的结构,您应该使用$components
。
参见Rule #2. Use 7 special keywords to declare the cell structure在 celljs 网站上。 $html
位于 $text
正下方。
关于javascript - 如何使用 Cell.js 在 $text 中注入(inject)另一个 html 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45969906/