使用的是vue-esign组件
- npm install vue-esign 首先下载组件
- 在main.js中引入vue-esign,并且挂载
-
import { createApp } from 'vue'; import App from './App.vue'; const app = createApp(App);import vueEsign from 'vue-esign' app.use(vueEsign )
- 页面使用(html-js)
<vue-esign ref="esign2" :width="800" :height="300" />
<el-button type="warning" @click="handleReset">清空画板</el-button>
<el-button type="primary" @click="handleGenerate">生成图片</el-button>
- vue3的js中
-
let esign2 = ref() //画布 function handleReset() {//清空画布esign2.value.reset() } function handleGenerate() { //生成base64图片esign2.value.generate().then( res => {signInfo.value = res} ) }