vue 页面使用原生态JS函数

1.

'<img src="'+this.api + commonService.captchaImage + '" onclick="refreshCaptcha(this)"  style="margin-top:10px;border: 1px solid #b4bccc;cursor: pointer;" title="点击刷新" />'

2.

methods: {    
    refreshCaptcha(e){
        e.src = this.api + commonService.captchaImage + '?t=' + new Date().getTime();
        //document.getElementById('captcha').src = this.api + commonService.captchaImage + '?t=' + new    Date().getTime();
    },
}

3.

created() {    
    window.refreshCaptcha = this.refreshCaptcha;
}
发布了69 篇原创文章 · 获赞 19 · 访问量 24万+

猜你喜欢

转载自blog.csdn.net/tyjlearning/article/details/105148082
今日推荐