第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

json數(shù)據(jù)無(wú)法渲染到瀏覽器

const?fs?=?require('fs')

?var?data?=?fs.readFileSync('./data/list.json')

??data?=?JSON.parse(data)


??var?list?=?data.splice(body.page?*?body.count,body.count)

??ctx.body?=?{

????errcode:0,

????errmsg:'ok',

????list

??}

??//?ctx.body?=?'ok'

})



js數(shù)據(jù)

?<script?id="tpl-sportsList"?type="text/html">

????????{{each?list}}

????????????????????<li>

????????????????????????<div?class="sports-list-text">

????????????????????????????<p>

????????????????????????????????{{$value.title}}

????????????????????????????</p>

????????????????????????????<p>

????????????????????????????????<span>{{$value.comment}}評(píng)</span>

????????????????????????????</p>

????????????????????????</div>

????????????????????????<div?class="sports-list-img">

????????????????????????????<img?src="{{$value.img}}"?alt=""/>

????????????????????????</div>

????????????????????</li>??

????????{{/each}}

????</script>

????<script>

????????var?sportsList?=?document.querySelector('.sports-list')

????????var?xhr?=?new?XMLHttpRequest()

????????xhr.onload?=?function(){

????????????if(xhr.status?==?200){

????????????????//?console.log(xhr.responseText)

????????????????var?data?=?JSON.parse(xhr.responseText)

????????????????if(data.errcode?==?0){

????????????????????sportsList.innerHTML?=?template('tpl-sportsList',data)

????????????????}

????????????}

????????}

????????xhr.open('POST','/index',true)

????????xhr.setRequestHeader('Content-Type','application/json')

????????xhr.send(JSON.stringify({"page"?:?0,"count"?:?10}))

????</script>




正在回答

1 回答

這個(gè)地方有問(wèn)題,運(yùn)行時(shí),彈出2,具體怎么解決還不清楚?

if(xhr.status?==?200){

alert(1)

}else{

alert(2)

}


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

西門(mén)老舅

走2的話(huà),說(shuō)明響應(yīng)有問(wèn)題,查看一下 xhr.status打印什么值
2021-08-29 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

json數(shù)據(jù)無(wú)法渲染到瀏覽器

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)