<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="root"></div>
<script>
var UI = {}
UI.Element = function() {}
UI.Element.prototype = {
append(child) {
this.dom.appendChild(child.dom);
return this;
}
}
UI.Panel = function(content) {
UI.Element.call(this);
this.dom = document.createElement("div");
this.dom.innerText = content;
}
UI.Panel.prototype = Object.assign(UI.Element.prototype, {
})
var root = document.getElementById("root");
root.appendChild(new UI.Panel("hunkXu").append(new UI.Panel("xuhaitao")).dom);
</script>
</body>
</html>
FR:徐海涛(hunk Xu)
QQ技术交流群:386476712