登录图片验证码功能

<img :src="codeUrl" class="images" @click="getImg"alt="">

注: 登录页面图形验证码功能,后端获取图形接口返回图片,从header里面取jdh字段 作为唯一标识;

data 里面  codeUrl:""

getVerifyCode().then(res=>{
        Cookies.set('jdh', res.headers.jdh)
        if(res){
          return 'data:image/png;base64,' + btoa(
            new Uint8Array(res.data).reduce((data, byte) => data + String.fromCharCode(byte), '')
          )
        }
      }).then(data => {
        this.codeUrl = data;
     })

posted on 2023-03-15 16:20  愿你笑时风华正茂  阅读(34)  评论(0)    收藏  举报

导航