2 回答
![?](http://img1.sycdn.imooc.com/545862aa0001f8da02200220-100-100.jpg)
TA贡献1880条经验 获得超4个赞
您rank in info在 v-for 中使用了错误的键,standings如果您要使用,请将其重命名为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 ?
});
}
编辑: 代码在下面工作正常,您的问题应该在其他地方。
https://jsfiddle.net/59Lnbk17/1/
![?](http://img1.sycdn.imooc.com/5458471300017f3702200220-100-100.jpg)
TA贡献1798条经验 获得超7个赞
这最终对我有用:
将分隔符从大括号更改为其他任何内容,因此 Django 也不会腐蚀它,因为它的变量也使用大括号。
根据初始问题工作的解决方案:
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>
添加回答
举报