Vue页面加载时,触发某个函数的方法

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

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

 

 1 mounted:function(){
 2       this.createcode();//需要触发的函数
 3     }
 4 //下面是createcode函数
 5  createcode(){
 6         var self = this;
 7         axios.post("/verifycode",{name:this.name,id:this.id}).then(function(res){
 8           //console.log(res);
 9           var url= JSON.parse(res.data.code64);
10           //console.log(url)
11           self.urlIMg  = url.data.base64Code;
12  
13         });
14       },

 

相关文章:

  • 2022-02-07
  • 2021-11-12
  • 2022-12-23
  • 2021-11-18
  • 2022-01-16
  • 2022-12-23
  • 2021-11-29
猜你喜欢
  • 2022-12-23
  • 2021-09-19
  • 2022-12-23
  • 2022-01-16
  • 2021-10-29
  • 2022-12-23
  • 2022-01-12
相关资源
相似解决方案