Created
June 30, 2019 16:21
-
-
Save curder/4a5e00c63620d4c446c5b840910a71d0 to your computer and use it in GitHub Desktop.
Vue组件之轮播图flickity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="bg-gray-100"> | |
<div style="width: 640px; height: 480px;"> | |
<carousel> | |
<img src="https://placeimg.com/640/480/any?1"> | |
<img src="https://placeimg.com/640/480/any?2"> | |
<img src="https://placeimg.com/640/480/any?3"> | |
<img src="https://placeimg.com/640/480/any?4"> | |
<img src="https://placeimg.com/640/480/any?5"> | |
</carousel> | |
</div> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<slot></slot> | |
</div> | |
</template> | |
<script> | |
import Flickity from 'flickity'; | |
import 'flickity/dist/flickity.min.css'; | |
export default { | |
props: { | |
cellAlign: { | |
default: 'left', | |
}, | |
contain: { | |
type: Boolean, | |
default: true, | |
}, | |
wrapAround: { | |
type: Boolean, | |
default: true, | |
}, | |
draggable: { | |
type: Boolean, | |
default: true, | |
}, | |
pageDots: { | |
type: Boolean, | |
default: true, | |
}, | |
autoPlay: { | |
type: Boolean | Number, | |
default: true, | |
}, | |
pauseAutoPlayOnHover: { | |
type: Boolean, | |
deault: false, | |
}, | |
fullscreen: { | |
type: Boolean, | |
default: false, | |
}, | |
fade: { | |
type: Boolean, | |
default: false, | |
}, | |
// More options see: https://flickity.metafizzy.co/options.html | |
}, | |
mounted() { | |
new Flickity(this.$el, this.$props); | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
安装依赖: