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>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM