首先需要引入验证码的js:gVerify.zip
<script src="js/gVerify.js"></script>
代码如下:
<input type="text" v-model='canvasYzm' style="width: 280px" placeholder="验证码"/><div class="pull-right" id="v_container" style="width: 101px;height: 40px;"></div>
初始化:
mounted:function () {
var that = this;
that.verifyCode=new GVerify("v_container")//生成验证码
}
效果如下:

