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

Excel导入组件的封装以及使用页面点击弹出该弹框

封装的组件

<template>
  <el-dialog
    width="500px"
    title="员工导入"
    :visible="showExcelDialog"
    @close="$emit('update:showExcelDialog', false)"
  >
    <el-row type="flex" justify="center">
      <div class="upload-excel">
        <input
          ref="excel-upload-input"
          class="excel-upload-input"
          type="file"
          accept=".xlsx, .xls"
        >
        <div class="drop">
          <i class="el-icon-upload" />
          <el-button type="text">下载导入模板</el-button>
          <span>将文件拖到此处或
            <el-button type="text">点击上传</el-button>
          </span>
        </div>
      </div>
    </el-row>
    <el-row type="flex" justify="end">
      <!-- update:props属性名,值 直接修改 .sync修饰符的属性值 -->
      <el-button size="mini" type="primary" @click="$emit('update:showExcelDialog', false)">取消</el-button>
    </el-row>
  </el-dialog>
</template>
<script>

export default {
  props: {
    showExcelDialog: {
      type: Boolean,
      default: false
    }
  },
  methods: {

  }
}
</script>

<style scoped lang="scss">
    .upload-excel {
      display: flex;
      justify-content: center;
      margin: 20px;
      width: 360px;
      height: 180px;
      align-items: center;
      color: #697086;
      .excel-upload-input {
        display: none;
        z-index: -9999;
      }
      .btn-upload,
      .drop {
        border: 1px dashed #dcdfe6;
        width: 100%;
        height: 100%;
        text-align: center;
        line-height: 160px;
        border-radius: 8px;
        display: flex;
        flex-direction: column;
        justify-content: center;
      }
      .drop {
        line-height: 40px;
        color: #bbb;
        i {
          font-size: 60px;
          display: block;
          color: #c0c4cc;
        }
      }
    }
</style>

在这里插入图片描述
在这里插入图片描述
在需要使用弹框页面
html

 <el-button size="mini" @click="showExcelDialog = true">excel导入</el-button>
 <import-excel :show-excel-dialog.sync="showExcelDialog" />

css

import ImportExcel from './components/import-excel.vue'
export default {
  components: {
    ImportExcel
  },
	data () {
	 return  {
	     showExcelDialog: false // 控制excel的弹层显示和隐藏
	 }
   }
 }

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

相关文章:

  • Nature子刊最新研究:Hi-C宏基因组揭示土壤-噬菌体-宿主相互作用
  • Django请求生命周期流程
  • Android WiFi的断开分析
  • ChatGPT到底是如何运作?
  • 水淹七军(递归,又是递归)
  • 【Unity记录】EDM4U(External Dependency Manager)使用说明
  • temu反洗钱协议在哪里签署
  • HashMap源码解析
  • 批量采集淘宝商品数据,有哪些方式可以实现?
  • 【Spark源码分析】事件总线机制分析
  • Python超级详细的变量命名规则
  • uniApp应用软件在运行时,未见向用户告知权限申请的目的,向用户索取(存储、相机、电话)等权限,不符合华为应用市场审核标准。
  • PostgreSQL数据库中的后台进程
  • 什么是美颜sdk?集成第三方美颜sdk的步骤
  • Vue3中el-table表格数据不显示
  • 在 Nginx 配置中,root 和 alias 指令的区别是什么
  • 深度学习框架配置
  • DHCP协议与域名系统
  • 力扣labuladong——一刷day50
  • Opencv 极坐标变换
  • YoloV8改进策略:基于RevCol,可逆的柱状神经网络的完美迁移,YoloV8的上分利器
  • 银河麒麟V10-ARM架构-postgresql安装与部署指南
  • 133. 面试官:JSBridge是什么?
  • Java面试题(每天10题)-------连载(39)
  • 【理解ARM架构】异常处理
  • 人工智能-优化算法之梯度下降
  • RLHF:强化学习结合大预言模型的训练方式
  • 在Mysql中,什么是回表,什么是覆盖索引,索引下推?
  • Qt 软件调试(一) Log日志调试
  • MapReduce概念