Closed curryhh closed 5 years ago
What's the problem?How to solve it?
This could be because there are no slides see related issues #74, if not can you please provide me with a working example, so I can help you debug this issue.
I solved the issue by adding some slides, as proposed by @Abdelrahman3D
I tested this against #104 and it looks like it would fix it.
> <template>
> <hooper v-if="bannerData && bannerData.length" :playSpeed="500" :itemsToShow="1.1" :centerMode="true" :infiniteScroll="true" :touchDrag="true">
> <slide v-for="(item,index) in bannerData" :key="index">
> <a :href="item.jump_url">
> <img :src="item.image_url" :alt="item.title">
> </a>
> </slide>
> <hooper-pagination slot="hooper-addons"></hooper-pagination>
> </hooper>
> </template>
>
> <script>
> import { Hooper, Slide, Pagination as HooperPagination } from 'hooper';
> import 'hooper/dist/hooper.css';
> // import {Toast} from'vant'
> export default {
> components: {
> Hooper,
> Slide,
> HooperPagination
> },
> data(){
> return{
> bannerData:[],
> }
> },
> mounted(){
> this.banner();
> },
> methods:{
> banner(){
> this.$api.home.banner().then(res => {
> this.bannerData=res
> // this.hooper.update()
> // console.log(this.bannerData);
> }).catch(error =>{
>
> console.log('error',error)
> //弹窗返回错误信息
> // Toast(error.msg);
> })
> },
> }
> }
> </script>
> <style lang="scss" scoped>
> .hooper-slide .is-current {
> transform: scale(1);
> }
> .hooper{
> height: 300px;
> width: 100%;
> display: inline-block;
> .hooper-slide{
> height: 100%;
> width: 100%;
> padding: 5px;
> display: inline-block;
> }
>
> }
>
> </style>
Now the console has no error, can't slide or play automatically
Describe the bug
To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context Add any other context about the problem here.