Authored by 陈峰

table的获取数据和upload id

<template>
<Upload ref="upload"
<Upload ref="upload"
:id="id"
:action="action"
:data="data"
:accept="accept"
... ... @@ -35,7 +36,8 @@ export default {
maxSize: {
type: Number,
default: 512 * 1024
}
},
id: ''
},
data() {
return {};
... ... @@ -47,11 +49,11 @@ export default {
if (_.get(response, 'data.imagesList.length', 0)) {
files = response.data.imagesList;
}
this.$emit('on-success', files);
this.$emit('on-success', this.id, files);
},
error(error) {
this.$Message.error('上传失败');
this.$emit('on-error', error);
this.$emit('on-error', this.id, error);
},
beforeUpload() {
this.$refs.upload.clearFiles();
... ...
<template>
<div>
overview
<Table ref="table" :data="data" :columns="columns"></Table>
<button @click="getTable">获得数据</button>
{{data}}
<br />
<editor :content="content" @change="updateData"></editor>
{{content}}
<yoho-upload @on-success="uploadSuccess" @on-error="uploadError"></yoho-upload>
<yoho-upload id="123" @on-success="uploadSuccess" @on-error="uploadError"></yoho-upload>
</div>
</template>
... ... @@ -14,17 +18,28 @@ export default {
data() {
return {
content: '',
columns: [
{title: '列', key: 'name', render(row, col, index) {
return `<input type="text" v-model="row.name" />`;
}}
],
data: [
{name: '1'}
]
};
},
methods: {
getTable() {
console.log(this.$refs.table.rebuildData);
},
updateData(c) {
this.content = c;
},
uploadSuccess(files) {
console.log(files)
uploadSuccess(id, files) {
console.log(id, files)
},
uploadError(error) {
console.error(error)
uploadError(id, error) {
console.log(id, error)
}
}
};
... ...