For details, please read https://www.jianshu.com/p/0de31429b12a this article
First install various tools:
-- 安装 docxtemplater
cnpm install docxtemplater pizzip --save
-- 安装 jszip-utils
cnpm install jszip-utils --save
-- 安装 jszip
cnpm install jszip --save
-- 安装 FileSaver
cnpm install file-saver --save
Then import it in the required file
Create a new word document, typeset the format, fill in the value in {name} format, and place it in the static directory.
Front-end html:
Data:
method:
effect: