downLoad.vue 911 Bytes
<!--
 * @Description: 页面提供插件下载
 * @Autor: renchao
 * @LastEditTime: 2023-06-13 15:49:55
-->
<template>
  <div class='downLoad'>
    <p>{{formData}}是否下载文件?</p>
    <div>
      <el-button @click="$popupCacel">取消</el-button>
      <el-button type="primary" @click="handleDown">确定</el-button>
    </div>
  </div>
</template>
<script>
  export default {
    props: {
      formData: {
        type: Object,
        default: {}
      }
    },
    methods: {
      handleDown () {
        let a = document.createElement('a')
        a.style.display = 'none'
        a.setAttribute('download', 'bg.jpg')
        // a.href = require('../../../../public/')
        document.body.appendChild(a)
        console.log('href', a.href)
        a.click()
        document.body.removeChild(a)
      }
    }
  }
</script>
<style scoped lang='scss'>
  @import "~@/styles/public.scss";
</style>