vue Click on the image to refresh the interface to get verification code verification code from the back

<img
alt = "Click Refresh"
: Src = "vsCode" // src refers to bring back the image path
@click="changeCodeImg()"
id="img_RandomCode"
title = "Click Refresh"
/>
//Click Refresh verification code
changeCodeImg () {// This is the time to click on the verification picture will refresh code
this.CodeImg();
},
data() {
return {
vsCode: "",}
// code
CodeImg () {// this is the function of the image verification code
let num = Math.ceil(Math.random() * 100);
this.vsCode = `${process.env.API_ROOT}/api/account/authcode?num=${num}`;
},

Note: where's the back side of the interface is the path of the random number to the path of dynamic binding: you can switch between images on the image path to reach src effect

Guess you like

Origin www.cnblogs.com/maibao666/p/11232812.html