需要在加载页面的时候调用生成验证码的click事件函数

解决方法如下,利用Vue中的mounted

mounted:function(){
      this.createcode();//需要触发的函数
    }
methods:{
    //下面是createcode函数
     createcode(){
        var self = this;
        axios.post("/verifycode",{name:this.name,id:this.id}).then(function(res){
          //console.log(res);
          var url= JSON.parse(res.data.code64);
          //console.log(url)
          self.urlIMg  = url.data.base64Code;

        });
      }, 
}

 

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐