<html>
head>
script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></scriptstyle>
#app {
border: 1px solid red;
left: 50%;
top: 50%;
width: 410px;
height: 235px;
}
.bg {
position: relative;
top: 5px;
left: 5px;
}
.left {
position: absolute;
top: 104px;
left: 15px;
}
.lbg {
height: 80px;
width: 30px;
opacity: 0.8;
}
.right {
position: absolute;
top: 104px;
left: 382px;
}
.rbg {
height: 80px;
width: 30px;
opacity: 0.8;
}
</>
bodydiv id="app">
img :src="imgurl[index]" alt="" class="bg"span>
a href="#"="left" @click="prev" v-show="index!=0">
=" ./img/left.jpg "=" "="lbg "a="# "="right "="next "="index<imgurl.length-1"="./img/right.jpg "="rbg "div
var app = new Vue({
el: '#app',data: {
imgurl: ["./img/img1.jpg ","./img/img2.jpg ","./img/img3.jpg ","./img/img4.jpg "],index: 0,},methods: {
prev: function () {
this.index -= 1;
},next: function () {
this.index += 1;
}
},})
>