Vue 前端导出功能

421 阅读1分钟

-Vue 导出功能

  <el-col :span="1.5">
    <el-button
      type="warning"
      icon="el-icon-download"
      size="mini"
      @click="handleExport"
      v-hasPermi="['system:user:export']"
      >导出</el-button
    >
  </el-col>
  
  // js
	import { getlist, add, exportList } from "@/api/management/student/list";

    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm("是否确认导出数据项?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(function () {
          return exportList(queryParams);
        })
        .then((response) => {
          this.download(response.msg);
        })
        .catch(function () {});
    },