社区文档构建进行中,欢迎编辑。社区答疑群(非官方):717421103,点点小课堂(腾讯会议):5696651544
全站通知:
BwikiLibrary/文档/createHtml
刷
历
编
阅读
2024-05-08更新
最新编辑:逗比的马老师
阅读:
更新日期:2024-05-08
最新编辑:逗比的马老师
< BwikiLibrary | 文档
跳到导航
跳到搜索
createHtml(item) → {jQuery.object} #
通过传入 JSON 对象字面量 快速创建html结构体,如果传入纯文本则为html标签内容。
参数(Parameters):
名称 | 类型 | 描述 |
---|---|---|
item | object|string |
返回值(Returns):
类型 | 描述 |
---|---|
jQuery.object |
例:
var item = {
"tag": "div",
"class": "abc",
"id": "test",
"children": [
{
"tag": "span",
"style": "color:red",
"children": [
"例子"
]
}
]
}
var html = BWIKI.createHtml(item); // html 为 jQuery.object
console.log(html[0]); // 输出 <div class="abc" id="test"><span style="color:red">例子</span></div>