<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>title</title>
<body>
<div id="app" class="container">
<header class="header">
<div class="swiper">
<div class="swiper-container swiper-banner" >
<ul class="swiper-wrapper">
<li class="swiper-slide" v-for="value in lbt" v-bind:style="{background:'url('+value.img+')'}"></li>
</ul>
</div>
</div>
</header>
</div>
<script src="js/vue.min.js"></script>
<script src="js/swiper.min.js"></script>
<script>
new Vue({
el:"#app",
data(){
return{
home :"首页",
classify:"分类",
shop:"购物车",
my:"我的",
lbt:[
{"img":"images/banner1.png"},
{"img":"images/banner2.png"},
{"img":"images/banner3.png"}
]
}
},
mounted(){
this.lunbo()
},
methods:{
lunbo(){
galleryTop = new Swiper('.swiper-banner',{
pagination: '.swiper-pagination',
paginationClickable: true,
speed: 1000,
loop: true,
observer:true,
observeParents:true,
autoplayDisableOnInteraction : false,
autoplay:5000,
paginationClickable: true
})
},
// stopPlay(){
// galleryTop.stopAutoplay()
// },
// play(){
// galleryTop.stopAutoplay()
// }
}
})
</script>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>title</title>
<link rel="stylesheet" href="css/swiper.min.css">
<style>
.header{
height:1.8rem;
}
.header .swiper{
height:100%;
}
.header .swiper .swiper-banner{
height:100%;
}
</style>
</head><body>
<div id="app" class="container">
<header class="header">
<div class="swiper">
<div class="swiper-container swiper-banner" >
<ul class="swiper-wrapper">
<li class="swiper-slide" v-for="value in lbt" v-bind:style="{background:'url('+value.img+')'}"></li>
</ul>
</div>
</div>
</header>
</div>
<script src="js/vue.min.js"></script>
<script src="js/swiper.min.js"></script>
<script>
new Vue({
el:"#app",
data(){
return{
home :"首页",
classify:"分类",
shop:"购物车",
my:"我的",
lbt:[
{"img":"images/banner1.png"},
{"img":"images/banner2.png"},
{"img":"images/banner3.png"}
]
}
},
mounted(){
this.lunbo()
},
methods:{
lunbo(){
galleryTop = new Swiper('.swiper-banner',{
pagination: '.swiper-pagination',
paginationClickable: true,
speed: 1000,
loop: true,
observer:true,
observeParents:true,
autoplayDisableOnInteraction : false,
autoplay:5000,
paginationClickable: true
})
},
// stopPlay(){
// galleryTop.stopAutoplay()
// },
// play(){
// galleryTop.stopAutoplay()
// }
}
})
</script>
</body>
</html>