1、首先,终端安装依赖
npm i svgaplayerweb --save
2、在需要使用的地方引入svga
import SVGA from 'svgaplayerweb';
例如:
3、接下来开始在el-upload中引入svga:
将upload中对应的img替换成:
<div v-if="formData.moveimgUrl" id="demoCanvas" class="svga" ref="canvas"></div>
<el-form-item label="动态图:" class="mallimg" prop="imgUrl">
<el-upload class="avatar-uploader" :headers="headers" :action="actionUrl"
:show-file-list="false" :on-success="handleAvatarSuccess1"
accept=".svga"
:before-upload="beforeAvatarUpload1">
<!-- <img v-if="formData.moveimgUr