我正在从Coldfusion Framework / 1 API中以JSON格式获取此数据:
{
"COLUMNS": [
"PRODUCT_ID",
"PRODUCT_NAME",
"PRODUCT_STATUS",
"DT_CREATED"
],
"DATA": [
[
102,
"Window",
"In Production",
"November, 02 2018 10:33:13"
],
[
105,
"Window",
"Delivered",
"November, 11 2018 15:00:00"
],
ETC...
]
}
在开发人员工具中,使用Vue工具,我得到了:
我正在使用axios
new Vue({
el: '#windows-list-data',
data() {
return {
windows: null,
loading: true,
errored: false
}
},
mounted() {
axios
.get('https://my-server.local/index.cfm?action=api.get')
.then( response => {
this.windows = response.data
})
.catch( error => {
console.log(error)
this.errored = true
})
.finally( () => this.loading = false )
}
有人可以告诉我如何在视图中使用Vuejs渲染数据吗? 谢谢
答案 0 :(得分:1)
似乎应该改变
this.windows = response.data
到
let respDataStr = response.data
let jsObject = JSON.parse(respDataStr)
this.windows = jsObject