This commit is contained in:
alvis
2020-06-14 16:44:45 +08:00
parent 6a10ed3e16
commit 943dae05da
2150 changed files with 986029 additions and 17 deletions

View File

@@ -0,0 +1,42 @@
Component({
externalClasses: ['i-class'],
options: {
multipleSlots: true
},
properties: {
// button || number || pointer
mode: {
type: String,
value: 'button'
},
current: {
type: Number,
value: 1
},
total: {
type: Number,
value: 0
},
// 是否隐藏数值
simple: {
type: Boolean,
value: false
}
},
methods: {
handleChange (type) {
this.triggerEvent('change', {
type: type
});
},
handlePrev () {
this.handleChange('prev');
},
handleNext () {
this.handleChange('next');
}
}
});

View File

@@ -0,0 +1,7 @@
{
"component": true,
"usingComponents":
{
"i-button": "../button/index"
}
}

View File

@@ -0,0 +1,14 @@
<view class="i-class i-page">
<view class="i-page-prev" wx:if="{{ mode === 'button' }}">
<i-button i-class="i-page-button" type="ghost" bindclick="handlePrev" disabled="{{ current === 1 }}"><slot name="prev"></slot></i-button>
</view>
<view class="i-page-number" wx:if="{{ mode !== 'pointer' && !simple }}">
<view class="i-page-number-current">{{ current }}</view>/{{total}}
</view>
<view class="i-page-pointer" wx:if="{{ mode === 'pointer' }}">
<view class="i-page-pointer-dot {{ (index + 1) === current ? 'current' : '' }}" wx:for="{{ total }}" wx:key="index"></view>
</view>
<view class="i-page-next" wx:if="{{ mode === 'button' }}">
<i-button i-class="i-page-button" type="ghost" bindclick="handleNext" disabled="{{ current === total }}"><slot name="next"></slot></i-button>
</view>
</view>

View File

@@ -0,0 +1 @@
.i-page{display:block;width:100%;height:44px;overflow:hidden;box-sizing:border-box;position:relative}.i-page-prev{position:absolute;left:10px;top:0}.i-page-next{position:absolute;right:10px;top:0}.i-page-number{width:100%;height:44px;line-height:44px;margin:0 auto;text-align:center}.i-page-number-current{display:inline;color:#2d8cf0}.i-page-pointer{width:100%;height:44px;line-height:44px;margin:0 auto;text-align:center}.i-page-pointer-dot{display:inline-block;width:8px;height:8px;margin:0 2px;border-radius:50%;background:#bbbec4}.i-page-pointer-dot.current{background:#80848f}.i-page-button{display:inline-block;margin:0}