vue使用docxtemplater导出word
<template>
</template>
<script>
import JSZipUtils from "jszip-utils/dist/jszip-utils.js";
import Docxtemplater from "docxtemplater";
import PizZip from "pizzip";
import {
saveAs } from "file-saver";
import ImageModule from "docxtemplater-image-module-free";
function loadFile(url, callback) {
JSZipUtils.getBinaryContent(url, callback);
}
export default {
name: "DocRender",
data() {
return {
imageSize: {
},
imageMaxHeight: 0,
imageMaxWidth: 0,
templateLocaton: "",
content: {
},
outputname: "output.docx"
};
},
methods: {
export(
imageMaxHeight,
imageMaxWidth,
templateLocaton,
imageArray,
wordArray,
outputname
) {
this.content = Object.assign(imageArray, wordArray);
this.imageMaxHeight = imageMaxHeight;
this.imageMaxWidth = imageMaxWidth;
this