- 39
- 0
生成一个tbody的思路优化(注:只能createElement,只能在方法中生成)async geneTableList():Promise<any>{ let url = 'http://127.0.0.1:5000/test/annotation/genelist?pagesize=20'; url = url + '&pagenum=' + this.pagenum; url = this.filterparam?url + '&filterparam=' + this.filterparam : url; url = this.sortname?url + '&sort={"name":"' + this.sortname + '","isAsc":' + this.isasc+'}' : url; this.listEle.classList.add('el-table') this.listEle.appendChild(this.tbody) var httpRequest = new XMLHttpRequest(); //第一步:建立所需的对象 httpRequest.open('GET', url, true); //第二步:打开连接 将请求参数写在url中 ps:"./Ptest.php?name=test&nameone=testone" httpRequest.send(); //第三步:发送请求 将请求参数写在URL中 let that = this httpRequest.onreadystatechange = function () { if (httpRequest.readyState == 4 && httpRequest.status == 200) { var res = <any>JSON.parse(httpRequest.responseText) ; //获取到json字符串,还需解析 if(res.code == 200){ that.totalPage = res.totalpage res.data.forEach((item:any)=>{ const tr = document.createElement('tr') const tdCheckbox = document.createElement('td') const checkDiv = document.createElement('div') const checkbox = document.createElement('input') checkDiv.classList.add('cell') tdCheckbox.setAttribute('rowspan', '1') tdCheckbox.setAttribute('colspan', '1') checkbox.type = 'checkbox' const tdGene = document.createElement('td') const gene = document.createElement('div') gene.classList.add('cell') tdGene.setAttribute('rowspan', '1') tdGene.setAttribute('colspan', '1') gene.innerText = item.gene gene.setAttribute('value', item.gene) const tdMIDCount = document.createElement('td') const MIDCount = document.createElement('div') MIDCount.classList.add('cell') tdMIDCount.setAttribute('rowspan', '1') tdMIDCount.setAttribute('colspan', '1') MIDCount.innerText = item.MIDcount MIDCount.setAttribute('value', item.gene) const tdE10 = document.createElement('td') const E10 = document.createElement('div') E10.classList.add('cell') tdE10.setAttribute('rowspan', '1') tdE10.setAttribute('colspan', '1') E10.innerText = item.E10.toFixed(2) E10.setAttribute('value', item.gene) tdCheckbox.appendChild(checkDiv) checkDiv.appendChild(checkbox) tdGene.appendChild(gene) tdMIDCount.appendChild(MIDCount) tdE10.appendChild(E10) tr.appendChild(tdCheckbox) tr.appendChild(tdGene) tr.appendChild(tdMIDCount) tr.appendChild(tdE10) that.tbody.appendChild(tr) that.listEle.appendChild(that.tbody) }) } } }; return {tableDom: that.listEle, tablePage: that.totalPage}}
0
打赏
收藏
点击回答
网站公告
- 扫一扫访问手机版
回答动态

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器更新之后。服务器里面有部分玩家要重新创建角色是怎么回事啊?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题函数计算不同地域的是不能用内网吧?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题ARMS可以创建多个应用嘛?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题在ARMS如何申请加入公测呀?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题前端小程序接入这个arms具体是如何接入监控的,这个init方法在哪里进行添加?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器刚到期,是不是就不能再导出存档了呢?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器的游戏版本不兼容 尝试更新怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器服务器升级以后 就链接不上了,怎么办?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器转移以后服务器进不去了,怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器修改参数后游戏进入不了,是什么情况?预计能赚取 0积分收益
- 回到顶部
- 回到顶部

