实现json数据绑定

This commit is contained in:
F嘉阳
2018-02-05 10:18:04 +08:00
parent cd17163b67
commit be2072f0f2
2 changed files with 21 additions and 24 deletions

View File

@@ -1,11 +1,12 @@
/*var data = "";
axios.get('http://localhost:8080/cms/download/findall')
.then(function (response) {
console.log(response);
resolve(response.data);
console.log(response.data);
data = response.data;
})
.catch(function (error) {
console.log(error);
});
});*/
var Main = {
data() {
return {
@@ -18,28 +19,22 @@ var Main = {
name: 'food2.jpeg',
url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'
}],
DownloadList: [
{
colfileid: 9,
coluserid: 0,
colip: '0:0:0:0:0:0:0:1',
colrealname: '234234',
colfilename: '10K.jpg',
colfilesize: '21.78KB',
colfilepath: 'C:\\Users\\11860\\AppData\\Local\\Temp\\tomcat-docbase.8051654935022807536.8080\\upload/10K.jpg'
},
{
colfileid: 15,
coluserid: 0,
colip: '0:0:0:0:0:0:0:1',
colrealname: null,
colfilename: '10K.jpg',
colfilesize: '21.78KB',
colfilepath: 'F:\\JAVA Workspace\\Temp\\upload/10K.jpg'
}
]
DownloadList: []
};
},
mounted(){
this.$nextTick(()=>{
var that=this;
axios.get('http://localhost:8080/cms/download/findall')
.then(function (response) {
console.log(response.data);
that.DownloadList = response.data;
})
.catch(function (error) {
console.log(error);
});})
},
methods: {
handleClick(row) {
console.log(row.colfileid);

View File

@@ -31,11 +31,13 @@
<div class="grid-content bg-purple-dark">
<el-table :data="DownloadList" height="250" border style="width: 100%">
<el-table-column prop="colfileid" label="文件号" width="80">
</el-table-column>
<el-table-column prop="colfilename" label="文件名" width="180">
</el-table-column>
<el-table-column prop="colfilesize" label="大小" width="80">
</el-table-column>
<el-table-column prop="colfileid" label="地址">
<el-table-column prop="colfilepath" label="地址">
</el-table-column>
<el-table-column fixed="right" label="操作" width="150">
<template slot-scope="scope">