当前位置: 首页 > article >正文

Vxe UI vue vxe-table 如何在表格中使用上传附件、上传图片

Vxe UI vue vxe-table 如何在表格中使用上传附件、上传图片

效果图

在表格中显示缩略图模式上传附件或图片在这里插入图片描述在这里插入图片描述
点击更多按钮查看全部
在这里插入图片描述
鼠标拖动上传
在这里插入图片描述

代码

<template>
  <div>
    <vxe-grid v-bind="gridOptions"></vxe-grid>
  </div>
</template>

<script setup>
import { reactive } from 'vue'
const fileList1CellRender = reactive({
  name: 'VxeUpload',
  props: {
    readonly: true,
    moreConfig: {
      maxCount: 1,
      layout: 'horizontal'
    }
  }
})
const fileList2CellRender = reactive({
  name: 'VxeUpload',
  props: {
    multiple: true,
    showButtonText: false,
    moreConfig: {
      maxCount: 1,
      layout: 'horizontal'
    }
  }
})
const imgList1CellRender = reactive({
  name: 'VxeUpload',
  props: {
    mode: 'image',
    readonly: true,
    moreConfig: {
      maxCount: 1
    },
    imageStyle: {
      width: 40,
      height: 40
    }
  }
})
const imgList2CellRender = reactive({
  name: 'VxeUpload',
  props: {
    mode: 'image',
    multiple: true,
    showButtonText: false,
    moreConfig: {
      maxCount: 1
    },
    imageStyle: {
      width: 40,
      height: 40
    }
  }
})
const gridOptions = reactive({
  border: true,
  showOverflow: true,
  columns: [
    { type: 'seq', width: 70 },
    { field: 'name', title: 'Name', minWidth: 180 },
    { field: 'fileList1', title: '附件列表', width: 240, cellRender: fileList1CellRender },
    { field: 'fileList2', title: '上传附件', width: 300, cellRender: fileList2CellRender },
    { field: 'imgList1', title: '图片列表', width: 160, cellRender: imgList1CellRender },
    { field: 'imgList2', title: '上传图片', width: 210, cellRender: imgList2CellRender }
  ],
  data: [
    {
      id: 10001,
      name: 'Test1',
      imgList1: [],
      imgList2: [],
      fileList1: [
        { name: 'fj562.png', url: 'https://vxeui.com/resource/img/fj562.png' }
      ],
      fileList2: [
        { name: 'fj562.png', url: 'https://vxeui.com/resource/img/fj562.png' }
      ]
    },
    {
      id: 10002,
      name: 'Test2',
      imgList1: [
        { name: 'fj562.png', url: 'https://vxeui.com/resource/img/fj562.png' },
        { name: 'fj573.jpeg', url: 'https://vxeui.com/resource/img/fj573.jpeg' }
      ],
      imgList2: [
        { name: 'fj562.png', url: 'https://vxeui.com/resource/img/fj562.png' },
        { name: 'fj573.jpeg', url: 'https://vxeui.com/resource/img/fj573.jpeg' }
      ],
      fileList1: [],
      fileList2: []
    },
    {
      id: 10003,
      name: 'Test3',
      imgList1: [
        { name: 'fj577.jpg', url: 'https://vxeui.com/resource/img/fj577.jpg' }
      ],
      imgList2: [
        { name: 'fj577.jpg', url: 'https://vxeui.com/resource/img/fj577.jpg' }
      ],
      fileList1: [
        { name: 'fj562.png', url: 'https://vxeui.com/resource/img/fj562.png' },
        { name: 'fj573.jpeg', url: 'https://vxeui.com/resource/img/fj573.jpeg' },
        { name: 'fj187.jpg', url: 'https://vxeui.com/resource/img/fj187.jpg' }
      ],
      fileList2: [
        { name: 'fj562.png', url: 'https://vxeui.com/resource/img/fj562.png' },
        { name: 'fj573.jpeg', url: 'https://vxeui.com/resource/img/fj573.jpeg' },
        { name: 'fj187.jpg', url: 'https://vxeui.com/resource/img/fj187.jpg' }
      ]
    }
  ]
})
</script>

http://www.kler.cn/news/283860.html

相关文章:

  • Linux下编译安装SuperLU
  • 应对Java虚拟机(JVM)负载突然增大的全面指南
  • Sentinel-1 Level 1数据处理的详细算法定义(七)
  • ARM/Linux嵌入式面经(三二):百度
  • 【区块链 + 司法存证】智慧审判留痕系统 | FISCO BCOS应用案例
  • 掀起社交娱乐新浪潮!AI如何应用到短视频APP?
  • Windows 局域网文件共享
  • js 如何获取文件名
  • 哈希(C语言)
  • 华为设备ENSP-AAA认证配置
  • Python | Leetcode Python题解之第386题字典序排数
  • FPGA 学习之路:挑战与策略
  • 磁盘I/O性能优化示例
  • Go 语言中的接口详解
  • Django 使用Apscheduler执行定时任务
  • vue nginx部署 配置 解决href = ‘/login路由‘ 跳转404问题
  • 代码随想录刷题day17丨654.最大二叉树,617.合并二叉树,700.二叉搜索树中的搜索,98.验证二叉搜索树
  • Java线程生命周期详解_(1)
  • 在 Maven 的 POM 文件中配置 npm 镜像源
  • SpringMVC处理流程介绍
  • 【HuggingFace Transformers】BertSelfOutput 和 BertOutput源码解析
  • 开源个人云存储管理专家:Cloudreve
  • 零基础入门转录组数据分析——单基因ROC分析
  • Leetcode Java学习记录——动态规划基础_3
  • 尚硅谷大数据技术-Kafka视频教程-笔记01【Kafka 入门】
  • 8月30复盘日记
  • k8s-pod 实战四 什么是 Kubernetes Pod?如何在生产环境中使用它?(学习专场,实战就看这一篇就够了)
  • 把http网站变成https
  • WPF 使用PdfiumViewer实现PDF预览与打印
  • RabbitMQ本地Ubuntu系统环境部署与无公网IP远程连接服务端实战演示