May 30, 2021 Article blog
Vue thought is only available for beginners
v-on:click="prev"
v-on is used to bind events
v-if="条件"
v-if to control the existence (display) of a this dom, high performance consumption;
v-show="条件"
v-show to control the display properties of the element
v-bind:src="#"
vue simply controls the display and hiding of left and right arrows by
v-show="index!=0"
v-show="index<imgArr.length-1"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>轮播图</title>
<script src="jsue.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="texts" href=".s/lunbotu.css"/>
</head>
<body>
<div id="mask">
<!-- 轮播图片 -->
<img :src="imgArr[index]" id="maskimg">
<!-- 左箭头 -->
<a href="javascript:void(0)" class="aBlock" @click="prev" v-if="index!=0">
<img src="./img1/prev.png" class="left" >
</a>
<!-- 右箭头 -->
<a href="javascript:void(0)" class="aBlock" id="ARight" @click="next" v-if="index<imgArr.length-1">
<img src="./img1/next.png" class="right" >
</a>
</div>
<script>
var vmm =new Vue({
el:"#mask",
data:{
imgArr:[
"./img/01.png",
"./img/00.png",
"./img/02.png",
"./img/03.png",
"./img/04.png",
"./img/05.png",
"./img/06.png",
"./img/07.png",
],
index:0
},
methods:{
prev:function(){
this.index--
},
next:function(){
this.index++
}
}
})
</script>
</body>
<html>