我从 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 工具,我得到了这个:
- 数据
- 错误:假
- 加载:真
- 窗户:对象
- 列:数组[4]
- 数据:数组[22]
我正在使用 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 中的数据吗?谢谢