zoukankan      html  css  js  c++  java
  • element 导出功能

    导出按钮:

      <el-button type="primary" class="btns c-ff c-main-btn" @click="downLoadAllHand">批量导出</el-button>

    调函数:

          // 导出
          downLoadAllHand () {
            const url = `/manage/reader/stat/export`
            const params = {...this.searchForm}
            openForm(url, params, "POST")
          },
    

      

    打开文件:

    export const openForm = (url, params, method) => {
      const form = _createElement(({
        tag: 'form',
        attr: {
          id: 'newsForm',
          name: 'newsForm',
          target: '_blank',
          method: method,
          action: url
        }
      }))
      Object.keys(params).forEach(item=>{
        let input = document.createElement('input')
        input.type = 'text'
        input.name = item
        input.value = params[item]
        form.appendChild(input)
      })
      document.body.appendChild(form)
      form.submit()
      document.body.removeChild(form)
    }
    具体函数:
     
     export const openForm = (url, params, method) => {
      const form = _createElement(({
        tag: 'form',
        attr: {
          id: 'newsForm',
          name: 'newsForm',
          target: '_blank',
          method: method,
          action: url
        }
      }))
      Object.keys(params).forEach(item=>{
        let input = document.createElement('input')
        input.type = 'text'
        input.name = item
        input.value = params[item]
        form.appendChild(input)
      })
      document.body.appendChild(form)
      form.submit()
      document.body.removeChild(form)
    }
    调函数:
     
    downLoadAllHand () {
    const url = `/manage/reader/stat/export`
    const params = {...this.searchForm}
    openForm(url, params, "POST")
    },
     
    导出按钮:
     
    <template slot="moreBtns">
    <el-button type="primary" class="btns c-ff c-main-btn" @click="downLoadAllHand">批量导出</el-button>
    </template>
  • 相关阅读:
    每天一个linux命令
    Python 面向对象-下篇
    Python 面向对象-上篇
    何时会发生隐式类型转换
    C++类型检查
    无符号保留原则
    bool类型为什么可以当做int
    在类的外部定义成员函数注意形式
    局部类
    命名规范
  • 原文地址:https://www.cnblogs.com/guangzhou11/p/13959480.html
Copyright © 2011-2022 走看看