<canvas bindtouchend="onTap" style="width:{{cvs.width}}px;height:{{cvs.height}}px;" canvas-id="canvas"></canvas>
假设mcaptcha.js文件放在utils下边
let Mcaptcha = require('../../utils/mcaptcha.js');
............
data:{
cvs:{
width:120,
height:35
}
},
onReady: function () {
this.mcaptcha = new Mcaptcha({
el: 'canvas',
width: this.data.cvs.width,
height: this.data.cvs.height,
code: "afced"
);
},
//刷新图形验证码
onTap(){
this.mcaptcha.refresh("ftgcv");
},
..........