在部署服务器后,使用 svg-captcha 插件获取svg验证码会多次请求不刷新,这里只要在请求的参数data中添加一个不重复的字符串就可以,比如:时间戳。
1. getCode () {
2. this.$api.get(this.$root.urlPath.MJK + '/code', {code:Date.now()},res => { // 这里是发送当前时间
3. console.log(res.data)
4. if (res.data.code === 200) {
5. this.code = res.data.data.img
6. } else {
7. this.$message.error(res.data.msg)
8. }
9. })
10. },