首页 > 其他 > 详细

element 导出功能

时间:2020-11-11 18:04:49      阅读:68      评论:0      收藏:0      [点我收藏+]

导出按钮:

  <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>

 

element 导出功能

原文:https://www.cnblogs.com/guangzhou11/p/13959480.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!