islider 在vue中怎么使用?

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no"/>
    <title>iSlider more animation</title>
    <link href="public/css/iSlider.css" rel="stylesheet">
    <style>
        body {
            margin: 0;
            padding: 0;
            background: #333;
            overflow: hidden;
        }

        /*ul wrapper*/
        #iSlider-wrapper {
            height: 100%;
            width: 100%;
            overflow: hidden;
            position: absolute;
        }

        #iSlider-wrapper ul {
            list-style: none;
            margin: 0;
            padding: 0;
            height: 100%;
            overflow: hidden;
        }

        #iSlider-wrapper li {
            position: absolute;
            margin: 0;
            padding: 0;
            height: 100%;
            overflow: hidden;
            display: -webkit-box;
            -webkit-box-pack: center;
            -webkit-box-align: center;
            list-style: none;
        }

        #iSlider-wrapper li img {
            max-width: 100%;
            max-height: 100%;
        }
    </style>

</head>
<body>
<div id="iSlider-wrapper"></div>
<div id="hidden-space" style="display:none">
    <p style="font-size:3em;text-align: center;color:#04f512">A node in dom tree.</p>
</div>
<script type="text/javascript" src="public/js/iSlider.js"></script>
<script type="text/javascript" src="public/js/iSlider.animate.js"></script>
<script id="show-code">
    var list = [
        {content: "http://oyb5eykun.bkt.clouddn.com/banner3.jpg"},
        {content: "http://oyb5eykun.bkt.clouddn.com/banner3.jpg"},
        {content: "http://oyb5eykun.bkt.clouddn.com/banner3.jpg"},
        {content: "//be-fe.github.io/static/images/iSlider-card/4.jpg"},
        {content: "//be-fe.github.io/static/images/iSlider-card/5.jpg"},
        {content: "//be-fe.github.io/static/images/iSlider-card/6.jpg"},
        {content: "//be-fe.github.io/static/images/iSlider-card/7.jpg"},
        {content: "//be-fe.github.io/static/images/iSlider-card/8.jpg"}
    ];

    var S = new iSlider(document.getElementById('iSlider-wrapper'), list, {
        isLooping: 1,
        isOverspread: 1,
        isAutoplay: 1,
        animateTime: 800,
        animateType: 'flow'
    });
</script>
</body>
</html>





阅读 4.9k
1 个回答

方法是:


<template>
    <div class="lunbo">
    <div id="iSlider-wrapper" ref='swipe'></div>
    <div id="hidden-space" style="display:none">
        <p style="font-size:3em;text-align: center;color:#04f512">A node in dom tree.</p>
    </div>

    </div>
</template>

<script type="text/ecmascript-6">
import 'base/Carousel/iSlider'
import 'base/Carousel/iSlider.animate'
    export default {
      props: {
        swipeinfo: {
          type: Array
        }
      },
          data () {
          return {



          }
       },
       mounted() {
         this.neiStyle()

       },
          methods: {
        neiStyle() {
         setTimeout(() => {
            var self = this;
            var data = this.swipeinfo;
            self.S = new iSlider(self.$refs.swipe, data, {
                isLooping: 1,
                isOverspread: 1,
                isAutoplay: true,
                animateTime: 800,
                animateType: 'flow'
            }, 300);

          })
         
         
          });


        }



          },
          components: {




          }

    }

</script>

<style scoped lang="css" stylesheet="text/css">
body {
    margin: 0;
    padding: 0;
    background: #333;
    overflow: hidden;
}

/*ul wrapper*/
#iSlider-wrapper {
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: absolute;
}

#iSlider-wrapper ul {
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

#iSlider-wrapper li {
    position: absolute;
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-pack: center;
    -webkit-box-align: center;
    list-style: none;
}

#iSlider-wrapper li img {
    max-width: 100%;
    max-height: 100%;
}
</style>

<style scoped lang="scss">
@import "./iSlider.scss"
</style>

引用组件之后,传值,渲染之后卡顿,需要改变一下屏幕宽度,才能运行? 那是因为需要加一个延时加载,如果刚开始就执行的话,props还没有完全传值成功。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
1 篇内容引用
推荐问题
宣传栏