zoukankan      html  css  js  c++  java
  • 前端怎样获取后端生成的验证码图片,并且点击图片的时候改变验证码

    直接放在<img src="文件名"/> 就可以了,不用去调接口之类的

    点击的时候改变验证码图片:

      改一下src属性,url?一个随机数(防止缓存)

    <a href="javascript:;" @click="changeCodeImg()"><img :src="codeImg" alt="图片加载失败" /></a>
    created(){
        this.codeImg="url";
    },
    data:function(){
      return {
        codeImg:'',
      }
    },

     methods:{
      changeCodeImg:function(){
        var num=Math.ceil(Math.random()*10);//生成一个随机数(防止缓存)
        this.codeImg='url?'+num;
      }
    }

     

     

    点击之后,改变

  • 相关阅读:
    js中replace的正则替换
    ios沙盒路径
    Android开源框架
    小知识点
    __NSCFConstantString && __NSPlaceholderDictionary
    iq 格式分析
    C 函数
    Xcode报错
    XMPP Server
    H5网站借鉴
  • 原文地址:https://www.cnblogs.com/rachelch/p/8085016.html
Copyright © 2011-2022 走看看