生成随机数给接口穿过去 然后接口会返回一张照片
<div class="login-form-items" v-if="codeshow">
<van-field
v-model="authcode"
label="验证码"
placeholder="请输入验证码"
/>
<div class="captcha-wrapper">
<img :src="images" @click="getcode"/>
</div>
</div>
// 获取验证码
getcode() {
const randomLetterAndNums = Math.random()
.toString(36)
.substr(2);
request
.get(`/api/security/captcha/image/${randomLetterAndNums}`, {
responseType: "blob"
})
.then((res) => {
this.images = window.URL.createObjectURL(res);
})
.catch(() => {});
},