|
|
<template>
|
|
|
<div>
|
|
|
<div v-if="show">
|
|
|
<div class="upload-image-item" v-if="uploadList[0]">
|
|
|
<template v-if="uploadList[0].status === 'finished' || uploadList[0].url">
|
|
|
<img :src="uploadList[0].url">
|
...
|
...
|
@@ -57,6 +57,7 @@ export default { |
|
|
return {
|
|
|
imgUrl: '',
|
|
|
visible: false,
|
|
|
show: true,
|
|
|
uploadList: [],
|
|
|
defaultList: _this.defaultFile ? [{url: _this.defaultFile}] : []
|
|
|
};
|
...
|
...
|
@@ -94,11 +95,25 @@ export default { |
|
|
title: '超出文件大小限制',
|
|
|
desc: '文件 ' + file.name + ' 太大,不能超过 2M。'
|
|
|
});
|
|
|
},
|
|
|
render: function() {
|
|
|
this.show = false;
|
|
|
this.$nextTick(() => {
|
|
|
this.show = true;
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
this.uploadList = this.$refs.upload.fileList;
|
|
|
},
|
|
|
watch: {
|
|
|
defaultFile: function(newValue) {
|
|
|
if (newValue) {
|
|
|
this.$refs.upload.fileList.push({url: this.defaultFile});
|
|
|
this.render();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
<style>
|
...
|
...
|
|