Quick Start
13 |Installation(安装)
14 |16 |     npm install vue-image-scroll 17 |
18 |
20 |
Usage(使用方法)
21 |
23 | <template>
24 | <div>
25 | <slider v-bind="setting">
26 | </div>
27 | </template>
28 |
29 | <script>
30 | import slider from 'vue-image-scroll';
31 |
32 | export default {
33 | components: {
34 | slider
35 | },
36 | data: function() {
37 | return {
38 | setting: {
39 | image: ['1.jpg', '2.jpg', '3.jpg']
40 | }
41 | }
42 | }
43 | }
44 | </script>
45 |
46 | 48 |
Value-Default(默认值)
49 |51 | { 52 | styleObject:{ 53 | width: '750', 54 | height: '250' 55 | }, //滚动框样式 宽度默认750px 高度默认250px 其余样式小驼峰命名 56 | background-color => backgroundColor 57 | image: null, //图片数组 58 | interval:2000, //滚动间隔,单位ms,默认2000 59 | imgStyle:null,//图片样式,宽度和高度不可设置,样式名字小驼峰命名 60 | autoRoll:true, //自动滚动 61 | direction:left //滚动方向, left or right 62 | } 63 |64 |
Example
68 |default
70 |73 | { 74 | image: [ 75 | 'static/img/1-1.jpg', 76 | 'static/img/1-2.jpg', 77 | 'static/img/1-3.jpg', 78 | 'static/img/1-4.jpg', 79 | 'static/img/1-5.jpg' 80 | ] 81 | } 82 |83 |
Setting1
88 |91 | { 92 | styleObject: { 93 | width: '550', 94 | height: '250', 95 | backgroundColor: 'rgba(0,225,226,0.2)', 96 | borderRadius: '20px' 97 | }, 98 | image: [ 99 | { 100 | src: 'static/img/1-1.jpg', 101 | tagName: '我是标签1', //标签内容 102 | tagStyle: { //标签样式 103 | backgroundColor: 'blue', 104 | } 105 | }, 106 | { 107 | src: 'static/img/1-2.jpg', 108 | tagName: '我是标签2', 109 | tagStyle: { 110 | backgroundColor: 'greeen', 111 | color: 'black', 112 | fontSize: '20px' 113 | } 114 | }, 115 | { 116 | src: 'static/img/1-3.jpg', 117 | tagName: '我是标签2' 118 | }, 119 | { 120 | src: 'static/img/1-4.jpg', 121 | tagName: '我是标签4' 122 | }, 123 | { 124 | src: 'static/img/1-5.jpg', 125 | tagName: '我是标签5' 126 | }, 127 | ], 128 | interval: 1000, 129 | imgStyle: { 130 | borderRadius: '20px' 131 | }, 132 | autoRoll: true, 133 | direction: 'right' 134 | } 135 |136 |
Setting2
141 |144 | { 145 | styleObject: { 146 | width: '250', 147 | height: '150' 148 | }, 149 | image: [ 150 | 'static/img/1-1.jpg', 151 | 'static/img/1-2.jpg', 152 | 'static/img/1-3.jpg', 153 | 'static/img/1-4.jpg', 154 | 'static/img/1-5.jpg'], 155 | imgStyle: { 156 | borderRadius: '20px' 157 | }, 158 | autoRoll: false, 159 | } 160 |161 |