From cfb5e5bb986c50d2ace87e03629f6210b3505413 Mon Sep 17 00:00:00 2001 From: cwpeng Date: Thu, 26 May 2022 03:51:50 +0800 Subject: [PATCH] Fix reference page bugs #152 --- index.html | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index 8425d5a..7142ca5 100644 --- a/index.html +++ b/index.html @@ -201,7 +201,7 @@ // update demo let component=null; const updateDemo=function(){ - const inputs=Array.from(table.querySelectorAll("input")); + const inputs=Array.from(attributesTable.querySelectorAll("input")); const code=`<${componentClass.documents.tagName}${inputs.map((input)=>{ if(input.value){ return ` ${input.attribute.name}="${input.value}"`; @@ -218,8 +218,8 @@ }; // attributes container.innerHTML+=`Attributes`; - let table=document.createElement("table"); - table.innerHTML=` + const attributesTable=document.createElement("table"); + attributesTable.innerHTML=` Name Default @@ -257,13 +257,16 @@ td=document.createElement("td"); td.appendChild(input); tr.appendChild(td); - table.appendChild(tr); + attributesTable.appendChild(tr); } - container.appendChild(table); + container.appendChild(attributesTable); // methods - container.innerHTML+=`Methods`; - table=document.createElement("table"); - table.innerHTML=` + let heading=document.createElement("w-heading"); + heading.level=4; + heading.textContent="Methods"; + container.appendChild(heading); + const methodsTable=document.createElement("table"); + methodsTable.innerHTML=` Name Arguments @@ -286,11 +289,14 @@ }); td.appendChild(btn); tr.appendChild(td); - // input - table.appendChild(tr); + methodsTable.appendChild(tr); } - container.appendChild(table); + container.appendChild(methodsTable); // demo + heading=document.createElement("w-heading"); + heading.level=4; + heading.textContent="Demo"; + container.appendChild(heading); const demoCode=document.createElement("div"); demoCode.className="demo-code"; container.appendChild(demoCode);