修复图片上传组件在同一页面中被多次引用时,仅有第一个组件拖拽功能生效的问题
Signed-off-by: 稚屿 <1491182878@qq.com>
This commit is contained in:
parent
88b0f5bcb2
commit
42fbf09dde
@ -28,7 +28,7 @@
|
|||||||
</el-upload>
|
</el-upload>
|
||||||
|
|
||||||
<!-- 文件列表 -->
|
<!-- 文件列表 -->
|
||||||
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
|
<transition-group ref="uploadFileList" class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
|
||||||
<li :key="file.url" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
|
<li :key="file.url" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
|
||||||
<el-link :href="`${baseUrl}${file.url}`" :underline="false" target="_blank">
|
<el-link :href="`${baseUrl}${file.url}`" :underline="false" target="_blank">
|
||||||
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
||||||
@ -105,7 +105,7 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
if (this.drag) {
|
if (this.drag) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const element = document.querySelector('.upload-file-list')
|
const element = this.$refs.uploadFileList?.$el || this.$refs.uploadFileList
|
||||||
Sortable.create(element, {
|
Sortable.create(element, {
|
||||||
ghostClass: 'file-upload-darg',
|
ghostClass: 'file-upload-darg',
|
||||||
onEnd: (evt) => {
|
onEnd: (evt) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user