这是 get 请求后端验证码!!!
这是 get 请求后端验证码!!!
这是 get 请求后端验证码!!!
重要的事情说三遍
真正一看就会的操作,不会你来打我啊,笨蛋
本来对验证码这边感觉请求很难,直到我看了这篇文章,弯路走的也不算多,主要get请求可以直接在网页上查看
原文来自博客园的一位大佬写的,链接双手奉上,代码片段顺带也粘过来了
// template部分
<a-input
style="width:60%"
size="large"
type="text"
placeholder="验证码: "
v-decorator="[
'verification',
{rules: [{ required: true, message: '请输入验证码' }], validateTrigger: 'change'}
]"
>
<a-icon slot="picture" type="user" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input>
<img style="float:right;height:40px" @click="replace" :src="imgCode" alt="">
//js部分
data () {
retrun {
imgCode: 'http://192.168.1.119:8000/cms/getCaptcha'
}
}
replace () {
const num = Math.ceil(Math.random() * 10) // 生成一个随机数(防止缓存)
this.imgCode = 'http://192.168.1.119:8000/cms/getCaptcha?' + num
}

被折叠的 条评论
为什么被折叠?



