1 Star 0 Fork 50

zd86 / avue-doc

forked from smallwei / avue-doc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
license.md 3.32 KB
一键复制 编辑 原始数据 按行查看 历史
smallwei 提交于 2020-05-30 20:51 . init docs
<script> export default { data () { return { form: { id: '', date: '', name: '', qq: '' } } }, computed: { data () { return { img: "/images/sqstemp.jpg", list: [{ left: 310, top: 625, text: `“ ${this.form.name} ”`, color: '#000', size: 29, bold: true, style: '黑体' }, { left: 690, top: 1077, text: this.form.id, color: '#000', size: 26, bold: true, style: '黑体' }, { left: 690, top: 1125, text: this.form.date, color: '#000', bold: true, size: 26, style: '黑体' }, { left: 440, top: 120, width:100, img:'/images/logo-bg.jpg' }] } } }, methods: { handleSend () { this.$message.success('请查看控制台'); this.$refs.license.getFile(this.form.name).then(file=>{ console.log(file); }) }, handleBase64(){ this.$message.success('请查看控制台'); this.$refs.license.getBase64().then(file=>{ console.log(file); }); }, handleUpload () { this.$refs.license.getPdf(this.form.name); } } } </script>

授权书 License

:::tip 2.0.5+ ::::

<!-- 导出pdf时导入需要的包 (一定要放到head标签里,不使用pdf功能则不用引入)-->
<script src="https://cdn.staticfile.org/jspdf/1.5.3/jspdf.min.js"></script>

:::demo

<el-button @click="handleUpload">导出PDF</el-button>
<el-button @click="handleSend"
               type="primary">获取文件流</el-button>
<el-button @click="handleBase64"
              type="danger">获取bas64</el-button>
 <avue-license ref="license"
                    :option="data">
    <h1 style="color:red">自定义内容</h1>
  </avue-license>
<script>
export default {
  data () {
    return {
      form: {
        id: '',
        date: '',
        name: '',
        qq: ''
      }
    }
  },
  computed: {
    data () {
      return {
        img: "/images/sqstemp.jpg",
        list: [{
          left: 310,
          top: 625,
          text: `“ ${this.form.name} ”`,
          color: '#000',
          size: 29,
          bold: true,
          style: '黑体'
        }, {
          left: 690,
          top: 1077,
          text: this.form.id,
          color: '#000',
          size: 26,
          bold: true,
          style: '黑体'
        }, {
          left: 690,
          top: 1125,
          text: this.form.date,
          color: '#000',
          bold: true,
          size: 26,
          style: '黑体'
        }, {
          left: 440,
          top: 120,
          width:100,
          img:'/images/logo-bg.jpg'
        }]
      }
    }
  },
  methods: {
    handleSend () {
      this.$message.success('请查看控制台');
      this.$refs.license.getFile(this.form.name).then(file=>{
          console.log(file);
      })
     
      
    },
    handleBase64(){
      this.$message.success('请查看控制台');
      this.$refs.license.getBase64().then(file=>{
        console.log(file);
      });
    },
    handleUpload () {
      this.$refs.license.getPdf(this.form.name);
    }
  }
}
</script>

:::

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/86zhangdong/avue-doc.git
git@gitee.com:86zhangdong/avue-doc.git
86zhangdong
avue-doc
avue-doc
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891