<template>
<div class="banner">
<div class="swiper-container" :class="swiperid">
<div class="swiper-wrapper">
<slot name="swiper-con">slot>
div>
<div :class='{"swiper-pagination":paginationshow}' :style='{"text-align":paginationdesition}'>div>
div>
div>
template>
<script>
import '../assets/libs/swiper/js/swiper.min.js' //引入第三方js库
export default {
props: { //props的高级使用,type表示传入的字符类型,default表示默认值
swiperid: {
type: String,
default: ''
},
paginationshow: {
type: Boolean,
default: true
},
paginationdesition: {
type: String,
default: 'center'
},
},
mounted: function(){
var _this = this
new Swiper('.' + _this.swiperid,{
direction: _this.declarations,
loop: _this.loop,
//....还有其他效果
})
}
}
script>
<style>
@import "../assets/libs/swiper/css/swiper.min.css"; /*引入第三方css库,注意了,这边引入的时候,最后一定要加分号(;)*/
style>