老师,请问 render() 是什么方法?
我的是自己添加的,成功运行,你可以看看,希望能帮到你。
function render(opt){
var child_node = document.createElement("div");
var child_node_child1 = document.createElement("div");
var child_node_child2 = document.createElement("div");
var child_node_child3 = document.createElement("div");
var child_node_child4 = document.createElement("div");
child_node_child1.setAttribute("class","table_child");
child_node_child2.setAttribute("class","table_child");
child_node_child3.setAttribute("class","table_child");
child_node_child4.setAttribute("class","table_child");
child_node_child1.setAttribute("style","float:left");
child_node_child2.setAttribute("style","float:left");
child_node_child3.setAttribute("style","float:left");
child_node_child4.setAttribute("style","float:left");
child_node_child1.innerHTML = name;
child_node_child2.innerHTML = opt.phone;
child_node_child3.innerHTML = opt.address;
child_node_child4.innerHTML = "<input type='button' value='删除'>"
child_node.appendChild(child_node_child1);
child_node.appendChild(child_node_child2);
child_node.appendChild(child_node_child3);
child_node.appendChild(child_node_child4);
child_node.setAttribute("class","table_tr");
child_node.setAttribute("id",opt.key);
var content = document.getElementById('content');
content.appendChild(child_node)
}
你是说react里面的render吗