vue 上传组件 vxe-upload 图片和附件拖拽调整顺序

vue 上传组件 vxe-upload 图片和附件拖拽调整顺序,通过设置 drag-sort 参数就可以启用拖拽排序功能

官网:https://vxeui.com/

图片拖拽排序

<template>
  <div>
    <vxe-upload v-model="imgList" mode="image" multiple drag-sort></vxe-upload>
  </div>
</template>

<script>
export default {
  data () {
    const imgList = [
      { name: 'fj577.jpg', url: 'https://vxeui.com/resource/img/fj577.jpg' },
      { name: 'fj581.jpeg', url: 'https://vxeui.com/resource/img/fj581.jpeg' },
      { name: 'fj187.jpeg', url: 'https://vxeui.com/resource/img/fj187.jpeg' },
      { name: 'fj579.jpeg', url: 'https://vxeui.com/resource/img/fj579.jpeg' },
      { name: 'fj843.jpeg', url: 'https://vxeui.com/resource/img/fj843.jpeg' }
    ]
    return {
      imgList
    }
  }
}
</script>

附件拖拽排序

<template>
  <div>
    <vxe-upload v-model="fileList" multiple drag-sort></vxe-upload>
  </div>
</template>

<script>
export default {
  data () {
    const fileList = [
      { name: 'fj577.jpg', url: 'https://vxeui.com/resource/img/fj577.jpg' },
      { name: 'fj581.jpeg', url: 'https://vxeui.com/resource/img/fj581.jpeg' },
      { name: 'fj573.jpeg', url: 'https://vxeui.com/resource/img/fj573.jpeg' },
      { name: 'fj579.png', url: 'https://vxeui.com/resource/img/fj579.png' },
      { name: 'fj586.png', url: 'https://vxeui.com/resource/img/fj586.png' }
    ]
    return {
      fileList
    }
  }
}
</script>

https://github.com/x-extends/vxe-pc-ui

posted @ 2024-12-16 20:20  可不简单  阅读(24)  评论(0编辑  收藏  举报