第一步 下载插件 npm i html2canvas -D
第二步引入插件 import html2canvas from 'html2canvas';
第三步使用插件
<template>
<div ref ="imageWrapper">要截图的元素,如果要截取整个页面,把ref ="imageWrapper"给到最外层的父元素</div>
<el-button @click="clickGeneratePicture(imageWrapper)">点击截图</el-button>
</template>
<