Skip to content

Commit 7a9fa5c

Browse files
committed
更新ZanUI最新组件
1 parent 94419db commit 7a9fa5c

5 files changed

Lines changed: 115 additions & 0 deletions

File tree

vendor/dist/actionsheet/index.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
'use strict';
2+
3+
Component({
4+
externalClasses: ['mask-class', 'container-class'],
5+
properties: {
6+
actions: {
7+
type: Array,
8+
value: []
9+
},
10+
show: {
11+
type: Boolean,
12+
value: false
13+
},
14+
cancelWithMask: {
15+
type: Boolean,
16+
value: true
17+
},
18+
cancelText: {
19+
type: String,
20+
value: ''
21+
}
22+
},
23+
methods: {
24+
onMaskClick: function onMaskClick() {
25+
if (this.data.cancelWithMask) {
26+
this.cancelClick();
27+
}
28+
},
29+
cancelClick: function cancelClick() {
30+
this.triggerEvent('cancel');
31+
},
32+
handleBtnClick: function handleBtnClick(_ref) {
33+
var _ref$currentTarget = _ref.currentTarget,
34+
currentTarget = _ref$currentTarget === undefined ? {} : _ref$currentTarget;
35+
36+
var dataset = currentTarget.dataset || {};
37+
var index = dataset.index;
38+
39+
this.triggerEvent('actionclick', { index: index });
40+
}
41+
}
42+
});

vendor/dist/actionsheet/index.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"component": true,
3+
"usingComponents": {
4+
"zan-btn": "../btn/index"
5+
}
6+
}

vendor/dist/actionsheet/index.wxml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<view class="zan-actionsheet {{ show ? 'zan-actionsheet--show' : '' }}">
2+
<view
3+
class="mask-class zan-actionsheet__mask"
4+
bindtap="onMaskClick"
5+
></view>
6+
<view class="container-class zan-actionsheet__container">
7+
<!-- 选项按钮 -->
8+
<zan-btn
9+
wx:for="{{ actions }}"
10+
wx:key="{{ index }}-{{ item.name }}"
11+
bind:btnclick="handleBtnClick"
12+
data-index="{{ index }}"
13+
open-type="{{ item.openType }}"
14+
custom-class="zan-actionsheet__btn"
15+
loading="{{ item.loading }}"
16+
>
17+
<!-- 自定义组件控制 slot 样式有问题,故在 slot 容器上传入 loading 信息 -->
18+
<view class="zan-actionsheet__btn-content {{ item.loading ? 'zan-actionsheet__btn--loading' : '' }}">
19+
<view class="zan-actionsheet__name">{{ item.name }}</view>
20+
<view
21+
wx:if="{{ item.subname }}"
22+
class="zan-actionsheet__subname">
23+
{{ item.subname }}
24+
</view>
25+
</view>
26+
</zan-btn>
27+
28+
<!-- 关闭按钮 -->
29+
<view
30+
wx:if="{{ cancelText }}"
31+
class="zan-actionsheet__footer"
32+
>
33+
<zan-btn
34+
custom-class="zan-actionsheet__btn"
35+
catchtap="cancelClick"
36+
>{{ cancelText }}</zan-btn>
37+
</view>
38+
</view>
39+
</view>

vendor/dist/actionsheet/index.wxss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.zan-actionsheet{background-color:#f8f8f8}.zan-actionsheet__mask{position:fixed;top:0;left:0;right:0;bottom:0;z-index:10;background:rgba(0,0,0,.7);display:none}.zan-actionsheet__container{position:fixed;left:0;right:0;bottom:0;background:#f8f8f8;-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0);-webkit-transform-origin:center;transform-origin:center;-webkit-transition:all .2s ease;transition:all .2s ease;z-index:11;opacity:0;visibility:hidden}.zan-actionsheet__btn{margin-bottom:0!important}.zan-actionsheet__footer .zan-actionsheet__btn{background:#fff}.zan-actionsheet__btn-content{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-box-pack:center;justify-content:center}.zan-actionsheet__subname{color:#999}.zan-actionsheet__name,.zan-actionsheet__subname{height:45px;line-height:45px}.zan-actionsheet__btn.zan-btn:last-child::after{border-bottom-width:0}.zan-actionsheet__subname{margin-left:2px;font-size:12px}.zan-actionsheet__footer{margin-top:10px}.zan-actionsheet__btn--loading .zan-actionsheet__subname{color:transparent}.zan-actionsheet--show .zan-actionsheet__container{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);visibility:visible}.zan-actionsheet--show .zan-actionsheet__mask{display:block}

vendor/dist/badge/index.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'use strict';
2+
3+
var DEFAULT_COLOR = '#fff';
4+
var DEFAULT_BACKGROUND_COLOR = '#f44';
5+
var DEFAULT_FONT_SIZE = 10;
6+
var DEFAULT_BOX_SHADOW = '0 0 0 2px #fff';
7+
8+
Component({
9+
properties: {
10+
color: {
11+
type: String,
12+
value: DEFAULT_COLOR
13+
},
14+
backgroundColor: {
15+
type: String,
16+
value: DEFAULT_BACKGROUND_COLOR
17+
},
18+
fontSize: {
19+
type: Number,
20+
value: DEFAULT_FONT_SIZE
21+
},
22+
boxShadow: {
23+
type: String,
24+
value: DEFAULT_BOX_SHADOW
25+
}
26+
}
27+
});

0 commit comments

Comments
 (0)