mirror of
https://github.com/yangzongzhuan/RuoYi-Vue3.git
synced 2025-09-27 14:52:40 +00:00
修复上传组件被多次引用拖动仅对第一个有效的问题
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
的文件
|
的文件
|
||||||
</div>
|
</div>
|
||||||
<!-- 文件列表 -->
|
<!-- 文件列表 -->
|
||||||
<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.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
|
<li :key="file.uid" 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>
|
||||||
@@ -216,7 +216,7 @@ function listToString(list, separator) {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (props.drag) {
|
if (props.drag) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const element = document.querySelector('.upload-file-list')
|
const element = proxy.$refs.uploadFileList?.$el || proxy.$refs.uploadFileList
|
||||||
Sortable.create(element, {
|
Sortable.create(element, {
|
||||||
ghostClass: 'file-upload-darg',
|
ghostClass: 'file-upload-darg',
|
||||||
onEnd: (evt) => {
|
onEnd: (evt) => {
|
||||||
|
@@ -227,7 +227,7 @@ function listToString(list, separator) {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (props.drag) {
|
if (props.drag) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const element = document.querySelector('.el-upload-list')
|
const element = proxy.$refs.imageUpload?.$el?.querySelector('.el-upload-list')
|
||||||
Sortable.create(element, {
|
Sortable.create(element, {
|
||||||
onEnd: (evt) => {
|
onEnd: (evt) => {
|
||||||
const movedItem = fileList.value.splice(evt.oldIndex, 1)[0]
|
const movedItem = fileList.value.splice(evt.oldIndex, 1)[0]
|
||||||
|
Reference in New Issue
Block a user