<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
<div class="LBT" @click="to" v-html="imgs[i]">
</div>
</div>
<script>
var app = new Vue({
el: "#app",
data: {
imgs: [
‘<img src="/img/1.jpg" class="img1">‘, ‘<img src="/img/2.jpg" class="img1">‘, ‘<img src="/img/3.jpg" class="img1">‘, ‘<img src="/img/4.jpg" class="img1">‘, ‘<img src="/img/5.jpg" class="img1">‘
],
i: 0,
},
methods: {
to() {
setInterval(function () {
app.i = app.i + 1;
if (app.i > 4) {
app.i = 0;
}
console.log(app.i);
}, 3000);
}
}
})
</script>
</body>
</html>