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       },

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM