2 回答

TA貢獻(xiàn)1880條經(jīng)驗(yàn) 獲得超4個(gè)贊
您rank in info在 v-for 中使用了錯(cuò)誤的鍵,standings如果您要使用,請(qǐng)將其重命名為standings.rank
<div class="table" id="Rank">
<div><p>Rank</p></div>
<div v-for="standings in info" class="rank"><p>{{ standings.rank }}</p></div>
</div>
更新
created() {
axios
.get("https://cors-anywhere.herokuapp.com/https://www.api-football.com/demo/api/v2/leagueTable/" + league_id)
.then(response => {
this.info = response.data.api.standings[0];
console.log('updated info', response.data.api.standings[0]); // can you share the value here ?
});
}
編輯: 代碼在下面工作正常,您的問(wèn)題應(yīng)該在其他地方。
https://jsfiddle.net/59Lnbk17/1/

TA貢獻(xiàn)1798條經(jīng)驗(yàn) 獲得超7個(gè)贊
這最終對(duì)我有用:
將分隔符從大括號(hào)更改為其他任何內(nèi)容,因此 Django 也不會(huì)腐蝕它,因?yàn)樗淖兞恳彩褂么罄ㄌ?hào)。
根據(jù)初始問(wèn)題工作的解決方案:
JS:
var app = new Vue({
delimiters : ['[[',']]'],
el: '#Rank',
data: {
info: []
},
created() {
axios
.get("https://cors-anywhere.herokuapp.com/https://www.api-football.com/demo/api/v2/leagueTable/" + league_id)
.then(response => {
this.info = response.data.api.standings[0];
console.log(response.data.api.standings[0]);
});
}
});
HTML:
<div id="app">
<div class="table" id="Rank">
<div><p>Rank</p></div>
<div v-for="standings in info" class="rank"><p>[[ standings.rank ]]</p></div>
</div></div>
添加回答
舉報(bào)