请补全JavaScript代码,要求将对象参数转换为真实的DOM结构并返回。 注意: 1. tag为标签名称、props为属性、children为子元素、text为标签内容
加载中...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> </head> <body> <script> var vnode = { tag: 'ul', props: { class: 'list' }, text: '', children: [ { tag: "li", props: { class: "item" }, text: '', children: [ { tag: undefined, props: {}, text: '牛客网', children: [] } ] }, { tag: "li", props: {}, text: '', children: [ { tag: undefined, props: {}, text: 'nowcoder', children: [] } ] } ] } const _createElm = vnode => { // 补全代码 } </script> </body> </html>