首先在github上down下来demo
vue-puzzle-verification
找一个你需要的
我这里选择的是控制误差的demo用。
使用方法:
npm i vue-puzzle-verification
在mian.js中引入
import PuzzleVerification from 'vue-puzzle-verification'
Vue.use(PuzzleVerification )
<div class="login-box">
<div class="puzzle-box">
<PuzzleVerification
v-model="isVerificationShow4"
:puzzleImgList="puzzleImgList"
deviation="20"
blockType="puzzle"
:onSuccess="handleSuccess"
/>
</div>
</div>
登录页面使用后会出现报错问题。
同事说是因为监听没有销毁…
所以
beforeDestory(){
document.removeEventListener("mousemove",this.moving);
document.removeEventListener("touchmove",this.moving);
document.removeEventListener("mouseup",this.moveEnd);
document.removeEventListener("touchend",this.moveEnd)
},