Vue_注册登录(短信验证码登录)
一、前言 1、动态获取图片验证码 2、实现手机验证码登录(工具准备) 3、手机验证码登录(后台实现) 3、前台实现 二、主要内容 1、动态获取图片验证码 (1)请求的接口如下,返回的是一张svg的图片 ## 获取一次性验证码 ### 请求URL: http: // localhost:3000/captcha ### 请求方式: (2)初次显示图片,可以直接在image中的src中请求路径直接得到 <!-- 第一次显示直接请求http://localhost:4000下面的 --> <!-- 点击图片的时候要更新图片,注册一个点击事件 --> < input type ="text" maxlength ="11" placeholder ="验证码" v-model ="captche" > < img class ="get_verification" src ="http://localhost:4000/captcha" alt ="captcha" @click ='getCaptcha' > (3)点击图片的时候更新,methods中调用方法 // 获取图片验证码 getCaptcha(event){ console.log( this ) console.log(event.target) event.target.src = "http://localhost