第一步:验证码样式
<u-form-item>
<u-input class="inp" type="text" v-model="code" placeholder="请输入验证码"></u-input>
<canvas :style="{width:width+'px',height:height+'px'}" canvas-id="canvas" @click="changeCode" @error="canvasIdErrorCallback"></canvas>
</u-form-item>
第二步:验证码逻辑
if (this.code.toLowerCase() != uni.getStorageSync('imgcode').toLowerCase()) {
uni.showToast({
icon: 'none',
position: 'bottom',
title: '验证码不正确'
});
return false;