【发布时间】:2021-04-28 21:37:55
【问题描述】:
我是 Vue.js 的新手。在这里,我试图实现从我的 Restful api 返回的一些 JSON 对象的渲染。当我从某个控件调用 allListing(streamid) 时,我需要呈现从 API 接收到的更改后的 JSON。玩了一整天,想来这里问问。
提前致谢。
callListing(1);
function callListing(streamid) {
var vm = new Vue({
el: '#app',
data() {
return {
info: []
}
},
created() {
axios
.get('https://localhost:44367/api/listing_institution/byselector/t/' + streamid + '/1')
.then(response => {
this.info = response.data,
console.log(response);
})
}
})
}
function fireListing(streamid) {
callListing(streamid);
}
<div id="app">
<div v-for="dt in info">
{{dt}}
</div>
</div>
【问题讨论】:
-
控件在哪里?应用外部?