@kengic/uni 0.5.1 → 0.5.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/uni/uni-ui/uni-badge/uni-badge.vue +222 -219
- package/dist/uni/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +29 -29
- package/dist/uni/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +88 -88
- package/dist/uni/uni-ui/uni-calendar/calendar.js +936 -532
- package/dist/uni/uni-ui/uni-calendar/i18n/en.json +10 -10
- package/dist/uni/uni-ui/uni-calendar/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hans.json +10 -10
- package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hant.json +10 -10
- package/dist/uni/uni-ui/uni-calendar/uni-calendar-item.vue +190 -168
- package/dist/uni/uni-ui/uni-calendar/uni-calendar.vue +459 -459
- package/dist/uni/uni-ui/uni-calendar/util.js +324 -340
- package/dist/uni/uni-ui/uni-card/uni-card.vue +8 -1
- package/dist/uni/uni-ui/uni-col/uni-col.vue +294 -287
- package/dist/uni/uni-ui/uni-collapse/uni-collapse.vue +139 -140
- package/dist/uni/uni-ui/uni-collapse-item/uni-collapse-item.vue +381 -378
- package/dist/uni/uni-ui/uni-combox/uni-combox.vue +280 -272
- package/dist/uni/uni-ui/uni-countdown/i18n/en.json +4 -4
- package/dist/uni/uni-ui/uni-countdown/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hans.json +4 -4
- package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hant.json +4 -4
- package/dist/uni/uni-ui/uni-countdown/uni-countdown.vue +249 -257
- package/dist/uni/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +832 -813
- package/dist/uni/uni-ui/uni-data-picker/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-data-picker/uni-data-picker.vue +535 -516
- package/dist/uni/uni-ui/uni-data-pickerview/uni-data-picker.js +623 -618
- package/dist/uni/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +293 -288
- package/dist/uni/uni-ui/uni-data-select/uni-data-select.vue +495 -509
- package/dist/uni/uni-ui/uni-dateformat/date-format.js +181 -184
- package/dist/uni/uni-ui/uni-dateformat/uni-dateformat.vue +81 -82
- package/dist/uni/uni-ui/uni-datetime-picker/calendar-item.vue +176 -170
- package/dist/uni/uni-ui/uni-datetime-picker/calendar.vue +926 -920
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/en.json +20 -20
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +21 -21
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +21 -21
- package/dist/uni/uni-ui/uni-datetime-picker/time-picker.vue +921 -926
- package/dist/uni/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1059 -1012
- package/dist/uni/uni-ui/uni-datetime-picker/util.js +366 -377
- package/dist/uni/uni-ui/uni-drawer/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-drawer/uni-drawer.vue +176 -167
- package/dist/uni/uni-ui/uni-easyinput/common.js +40 -42
- package/dist/uni/uni-ui/uni-easyinput/uni-easyinput.vue +628 -547
- package/dist/uni/uni-ui/uni-fab/uni-fab.vue +507 -483
- package/dist/uni/uni-ui/uni-fav/i18n/en.json +2 -2
- package/dist/uni/uni-ui/uni-fav/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-fav/i18n/zh-Hans.json +2 -2
- package/dist/uni/uni-ui/uni-fav/i18n/zh-Hant.json +2 -2
- package/dist/uni/uni-ui/uni-fav/uni-fav.vue +155 -147
- package/dist/uni/uni-ui/uni-file-picker/choose-and-upload-file.js +172 -198
- package/dist/uni/uni-ui/uni-file-picker/uni-file-picker.vue +636 -634
- package/dist/uni/uni-ui/uni-file-picker/upload-file.vue +294 -293
- package/dist/uni/uni-ui/uni-file-picker/upload-image.vue +267 -270
- package/dist/uni/uni-ui/uni-file-picker/utils.js +81 -82
- package/dist/uni/uni-ui/uni-forms/uni-forms.vue +360 -372
- package/dist/uni/uni-ui/uni-forms/utils.js +170 -174
- package/dist/uni/uni-ui/uni-forms/validate.js +447 -456
- package/dist/uni/uni-ui/uni-forms-item/uni-forms-item.vue +497 -497
- package/dist/uni/uni-ui/uni-goods-nav/i18n/en.json +4 -4
- package/dist/uni/uni-ui/uni-goods-nav/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hans.json +4 -4
- package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hant.json +4 -4
- package/dist/uni/uni-ui/uni-goods-nav/uni-goods-nav.vue +238 -222
- package/dist/uni/uni-ui/uni-grid/uni-grid.vue +134 -134
- package/dist/uni/uni-ui/uni-grid-item/uni-grid-item.vue +121 -119
- package/dist/uni/uni-ui/uni-group/uni-group.vue +121 -121
- package/dist/uni/uni-ui/uni-icons/icons.js +1170 -1168
- package/dist/uni/uni-ui/uni-icons/uni-icons.vue +91 -86
- package/dist/uni/uni-ui/uni-icons/uniicons.css +166 -166
- package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +129 -129
- package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list.vue +352 -347
- package/dist/uni/uni-ui/uni-link/uni-link.vue +134 -119
- package/dist/uni/uni-ui/uni-list/uni-list.vue +119 -110
- package/dist/uni/uni-ui/uni-list/uni-refresh.vue +14 -14
- package/dist/uni/uni-ui/uni-list/uni-refresh.wxs +14 -14
- package/dist/uni/uni-ui/uni-list-ad/uni-list-ad.vue +101 -95
- package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.scss +18 -18
- package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.vue +602 -586
- package/dist/uni/uni-ui/uni-list-item/uni-list-item.vue +507 -503
- package/dist/uni/uni-ui/uni-load-more/i18n/en.json +3 -3
- package/dist/uni/uni-ui/uni-load-more/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hans.json +3 -3
- package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hant.json +3 -3
- package/dist/uni/uni-ui/uni-load-more/uni-load-more.vue +402 -392
- package/dist/uni/uni-ui/uni-nav-bar/uni-nav-bar.vue +328 -330
- package/dist/uni/uni-ui/uni-nav-bar/uni-status-bar.vue +17 -17
- package/dist/uni/uni-ui/uni-notice-bar/uni-notice-bar.vue +422 -401
- package/dist/uni/uni-ui/uni-number-box/uni-number-box.vue +211 -205
- package/dist/uni/uni-ui/uni-pagination/i18n/en.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/es.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/fr.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/index.js +12 -11
- package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hans.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hant.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/uni-pagination.vue +450 -433
- package/dist/uni/uni-ui/uni-popup/uni-popup.vue +404 -404
- package/dist/uni/uni-ui/uni-popup-dialog/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +1 -0
- package/dist/uni/uni-ui/uni-popup-message/uni-popup-message.vue +126 -125
- package/dist/uni/uni-ui/uni-popup-share/uni-popup-share.vue +172 -172
- package/dist/uni/uni-ui/uni-rate/uni-rate.vue +343 -347
- package/dist/uni/uni-ui/uni-row/uni-row.vue +180 -182
- package/dist/uni/uni-ui/uni-scss/changelog.md +11 -4
- package/dist/uni/uni-ui/uni-scss/package.json +73 -73
- package/dist/uni/uni-ui/uni-scss/readme.md +2 -1
- package/dist/uni/uni-ui/uni-scss/styles/setting/_border.scss +2 -2
- package/dist/uni/uni-ui/uni-scss/styles/setting/_color.scss +46 -47
- package/dist/uni/uni-ui/uni-scss/styles/setting/_radius.scss +49 -49
- package/dist/uni/uni-ui/uni-scss/styles/setting/_space.scss +52 -53
- package/dist/uni/uni-ui/uni-scss/styles/setting/_styles.scss +142 -147
- package/dist/uni/uni-ui/uni-scss/styles/setting/_text.scss +20 -20
- package/dist/uni/uni-ui/uni-scss/styles/setting/_variables.scss +111 -95
- package/dist/uni/uni-ui/uni-scss/styles/tools/functions.scss +28 -18
- package/dist/uni/uni-ui/uni-scss/theme.scss +10 -7
- package/dist/uni/uni-ui/uni-scss/variables.scss +42 -24
- package/dist/uni/uni-ui/uni-search-bar/i18n/en.json +3 -3
- package/dist/uni/uni-ui/uni-search-bar/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hans.json +2 -2
- package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hant.json +2 -2
- package/dist/uni/uni-ui/uni-search-bar/uni-search-bar.vue +290 -281
- package/dist/uni/uni-ui/uni-section/uni-section.vue +149 -146
- package/dist/uni/uni-ui/uni-segmented-control/uni-segmented-control.vue +141 -131
- package/dist/uni/uni-ui/uni-steps/uni-steps.vue +255 -236
- package/dist/uni/uni-ui/uni-swipe-action/uni-swipe-action.vue +51 -51
- package/dist/uni/uni-ui/uni-swipe-action-item/bindingx.js +276 -282
- package/dist/uni/uni-ui/uni-swipe-action-item/isPC.js +10 -10
- package/dist/uni/uni-ui/uni-swipe-action-item/mpalipay.js +182 -187
- package/dist/uni/uni-ui/uni-swipe-action-item/mpother.js +235 -244
- package/dist/uni/uni-ui/uni-swipe-action-item/mpwxs.js +70 -75
- package/dist/uni/uni-ui/uni-swipe-action-item/render.js +238 -247
- package/dist/uni/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +387 -313
- package/dist/uni/uni-ui/uni-swipe-action-item/wx.wxs +206 -215
- package/dist/uni/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +241 -197
- package/dist/uni/uni-ui/uni-table/uni-table.vue +445 -447
- package/dist/uni/uni-ui/uni-tag/uni-tag.vue +234 -244
- package/dist/uni/uni-ui/uni-tbody/uni-tbody.vue +20 -23
- package/dist/uni/uni-ui/uni-td/uni-td.vue +79 -80
- package/dist/uni/uni-ui/uni-th/filter-dropdown.vue +510 -503
- package/dist/uni/uni-ui/uni-th/uni-th.vue +289 -273
- package/dist/uni/uni-ui/uni-thead/uni-thead.vue +115 -114
- package/dist/uni/uni-ui/uni-title/uni-title.vue +151 -154
- package/dist/uni/uni-ui/uni-tooltip/uni-tooltip.vue +55 -60
- package/dist/uni/uni-ui/uni-tr/table-checkbox.vue +162 -163
- package/dist/uni/uni-ui/uni-tr/uni-tr.vue +158 -157
- package/dist/uni/uni-ui/uni-transition/createAnimation.js +130 -113
- package/dist/uni/uni-ui/uni-transition/uni-transition.vue +274 -272
- package/package.json +1 -1
|
@@ -1,167 +1,170 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<view class="uni-section">
|
|
3
|
+
<view class="uni-section-header" @click="onClick">
|
|
4
|
+
<view class="uni-section-header__decoration" v-if="type" :class="type" />
|
|
5
|
+
<slot v-else name="decoration"></slot>
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
<view class="uni-section-header__content">
|
|
8
|
+
<text :style="{ 'font-size': titleFontSize, color: titleColor }" class="uni-section__content-title" :class="{ distraction: !subTitle }">{{
|
|
9
|
+
title
|
|
10
|
+
}}</text>
|
|
11
|
+
<text v-if="subTitle" :style="{ 'font-size': subTitleFontSize, color: subTitleColor }" class="uni-section-header__content-sub">{{
|
|
12
|
+
subTitle
|
|
13
|
+
}}</text>
|
|
14
|
+
</view>
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
<view class="uni-section-header__slot-right">
|
|
17
|
+
<slot name="right"></slot>
|
|
18
|
+
</view>
|
|
14
19
|
</view>
|
|
15
|
-
</view>
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
<view class="uni-section-content" :style="{ padding: _padding }">
|
|
22
|
+
<slot />
|
|
23
|
+
</view>
|
|
24
|
+
</view>
|
|
21
25
|
</template>
|
|
22
26
|
|
|
23
27
|
<script>
|
|
28
|
+
/**
|
|
29
|
+
* Section 标题栏
|
|
30
|
+
* @description 标题栏
|
|
31
|
+
* @property {String} type = [line|circle|square] 标题装饰类型
|
|
32
|
+
* @value line 竖线
|
|
33
|
+
* @value circle 圆形
|
|
34
|
+
* @value square 正方形
|
|
35
|
+
* @property {String} title 主标题
|
|
36
|
+
* @property {String} titleFontSize 主标题字体大小
|
|
37
|
+
* @property {String} titleColor 主标题字体颜色
|
|
38
|
+
* @property {String} subTitle 副标题
|
|
39
|
+
* @property {String} subTitleFontSize 副标题字体大小
|
|
40
|
+
* @property {String} subTitleColor 副标题字体颜色
|
|
41
|
+
* @property {String} padding 默认插槽 padding
|
|
42
|
+
*/
|
|
24
43
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
default: '12px'
|
|
69
|
-
},
|
|
70
|
-
subTitleColor: {
|
|
71
|
-
type: String,
|
|
72
|
-
default: '#999'
|
|
73
|
-
},
|
|
74
|
-
padding: {
|
|
75
|
-
type: [Boolean, String],
|
|
76
|
-
default: false
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
computed:{
|
|
80
|
-
_padding(){
|
|
81
|
-
if(typeof this.padding === 'string'){
|
|
82
|
-
return this.padding
|
|
83
|
-
}
|
|
44
|
+
export default {
|
|
45
|
+
name: 'UniSection',
|
|
46
|
+
emits: ['click'],
|
|
47
|
+
props: {
|
|
48
|
+
type: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: '',
|
|
51
|
+
},
|
|
52
|
+
title: {
|
|
53
|
+
type: String,
|
|
54
|
+
required: true,
|
|
55
|
+
default: '',
|
|
56
|
+
},
|
|
57
|
+
titleFontSize: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: '14px',
|
|
60
|
+
},
|
|
61
|
+
titleColor: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: '#333',
|
|
64
|
+
},
|
|
65
|
+
subTitle: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: '',
|
|
68
|
+
},
|
|
69
|
+
subTitleFontSize: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: '12px',
|
|
72
|
+
},
|
|
73
|
+
subTitleColor: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: '#999',
|
|
76
|
+
},
|
|
77
|
+
padding: {
|
|
78
|
+
type: [Boolean, String],
|
|
79
|
+
default: false,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
computed: {
|
|
83
|
+
_padding() {
|
|
84
|
+
if (typeof this.padding === 'string') {
|
|
85
|
+
return this.padding;
|
|
86
|
+
}
|
|
84
87
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
88
|
+
return this.padding ? '10px' : '';
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
watch: {
|
|
92
|
+
title(newVal) {
|
|
93
|
+
if (uni.report && newVal !== '') {
|
|
94
|
+
uni.report('title', newVal);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
methods: {
|
|
99
|
+
onClick() {
|
|
100
|
+
this.$emit('click');
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
101
104
|
</script>
|
|
102
|
-
<style lang="scss"
|
|
103
|
-
|
|
105
|
+
<style lang="scss">
|
|
106
|
+
$uni-primary: #2979ff !default;
|
|
104
107
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
108
|
+
.uni-section {
|
|
109
|
+
background-color: #fff;
|
|
110
|
+
.uni-section-header {
|
|
111
|
+
position: relative;
|
|
112
|
+
/* #ifndef APP-NVUE */
|
|
113
|
+
display: flex;
|
|
114
|
+
/* #endif */
|
|
115
|
+
flex-direction: row;
|
|
116
|
+
align-items: center;
|
|
117
|
+
padding: 12px 10px;
|
|
118
|
+
font-weight: normal;
|
|
116
119
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
&__decoration {
|
|
121
|
+
margin-right: 6px;
|
|
122
|
+
background-color: $uni-primary;
|
|
123
|
+
&.line {
|
|
124
|
+
width: 4px;
|
|
125
|
+
height: 12px;
|
|
126
|
+
border-radius: 10px;
|
|
127
|
+
}
|
|
125
128
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
&.circle {
|
|
130
|
+
width: 8px;
|
|
131
|
+
height: 8px;
|
|
132
|
+
border-top-right-radius: 50px;
|
|
133
|
+
border-top-left-radius: 50px;
|
|
134
|
+
border-bottom-left-radius: 50px;
|
|
135
|
+
border-bottom-right-radius: 50px;
|
|
136
|
+
}
|
|
134
137
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
&.square {
|
|
139
|
+
width: 8px;
|
|
140
|
+
height: 8px;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
140
143
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
&__content {
|
|
145
|
+
/* #ifndef APP-NVUE */
|
|
146
|
+
display: flex;
|
|
147
|
+
/* #endif */
|
|
148
|
+
flex-direction: column;
|
|
149
|
+
flex: 1;
|
|
150
|
+
color: #333;
|
|
148
151
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
152
|
+
.distraction {
|
|
153
|
+
flex-direction: row;
|
|
154
|
+
align-items: center;
|
|
155
|
+
}
|
|
156
|
+
&-sub {
|
|
157
|
+
margin-top: 2px;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
157
160
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
161
|
+
&__slot-right {
|
|
162
|
+
font-size: 14px;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
162
165
|
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
.uni-section-content {
|
|
167
|
+
font-size: 14px;
|
|
168
|
+
}
|
|
165
169
|
}
|
|
166
|
-
}
|
|
167
170
|
</style>
|
|
@@ -1,145 +1,155 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
<view
|
|
3
|
+
:class="[styleType === 'text' ? 'segmented-control--text' : 'segmented-control--button']"
|
|
4
|
+
:style="{ borderColor: styleType === 'text' ? '' : activeColor }"
|
|
5
|
+
class="segmented-control"
|
|
6
|
+
>
|
|
7
|
+
<view
|
|
8
|
+
v-for="(item, index) in values"
|
|
9
|
+
:class="[
|
|
10
|
+
styleType === 'text' ? '' : 'segmented-control__item--button',
|
|
11
|
+
index === currentIndex && styleType === 'button' ? 'segmented-control__item--button--active' : '',
|
|
12
|
+
index === 0 && styleType === 'button' ? 'segmented-control__item--button--first' : '',
|
|
13
|
+
index === values.length - 1 && styleType === 'button' ? 'segmented-control__item--button--last' : '',
|
|
14
|
+
]"
|
|
15
|
+
:key="index"
|
|
16
|
+
:style="{
|
|
17
|
+
backgroundColor: index === currentIndex && styleType === 'button' ? activeColor : '',
|
|
18
|
+
borderColor: index === currentIndex && (styleType === 'text' || styleType === 'button') ? activeColor : '#d9d9d9',
|
|
19
|
+
}"
|
|
20
|
+
class="segmented-control__item"
|
|
21
|
+
@click="_onClick(index)"
|
|
22
|
+
>
|
|
23
|
+
<view>
|
|
24
|
+
<text
|
|
25
|
+
:style="{ color: index === currentIndex ? (styleType === 'text' ? activeColor : '#fff') : styleType === 'text' ? '#000' : activeColor }"
|
|
26
|
+
class="segmented-control__text"
|
|
27
|
+
:class="styleType === 'text' && index === currentIndex ? 'segmented-control__item--text' : ''"
|
|
28
|
+
>{{ item }}</text
|
|
29
|
+
>
|
|
30
|
+
</view>
|
|
31
|
+
</view>
|
|
32
|
+
</view>
|
|
23
33
|
</template>
|
|
24
34
|
|
|
25
35
|
<script>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
/**
|
|
37
|
+
* SegmentedControl 分段器
|
|
38
|
+
* @description 用作不同视图的显示
|
|
39
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=54
|
|
40
|
+
* @property {Number} current 当前选中的tab索引值,从0计数
|
|
41
|
+
* @property {String} styleType = [button|text] 分段器样式类型
|
|
42
|
+
* @value button 按钮类型
|
|
43
|
+
* @value text 文字类型
|
|
44
|
+
* @property {String} activeColor 选中的标签背景色与边框颜色
|
|
45
|
+
* @property {Array} values 选项数组
|
|
46
|
+
* @event {Function} clickItem 组件触发点击事件时触发,e={currentIndex}
|
|
47
|
+
*/
|
|
38
48
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
49
|
+
export default {
|
|
50
|
+
name: 'UniSegmentedControl',
|
|
51
|
+
emits: ['clickItem'],
|
|
52
|
+
props: {
|
|
53
|
+
current: {
|
|
54
|
+
type: Number,
|
|
55
|
+
default: 0,
|
|
56
|
+
},
|
|
57
|
+
values: {
|
|
58
|
+
type: Array,
|
|
59
|
+
default() {
|
|
60
|
+
return [];
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
activeColor: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: '#2979FF',
|
|
66
|
+
},
|
|
67
|
+
styleType: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: 'button',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
data() {
|
|
73
|
+
return {
|
|
74
|
+
currentIndex: 0,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
watch: {
|
|
78
|
+
current(val) {
|
|
79
|
+
if (val !== this.currentIndex) {
|
|
80
|
+
this.currentIndex = val;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
created() {
|
|
85
|
+
this.currentIndex = this.current;
|
|
86
|
+
},
|
|
87
|
+
methods: {
|
|
88
|
+
_onClick(index) {
|
|
89
|
+
if (this.currentIndex !== index) {
|
|
90
|
+
this.currentIndex = index;
|
|
91
|
+
this.$emit('clickItem', {
|
|
92
|
+
currentIndex: index,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
};
|
|
88
98
|
</script>
|
|
89
99
|
|
|
90
|
-
<style lang="scss"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
<style lang="scss">
|
|
101
|
+
.segmented-control {
|
|
102
|
+
/* #ifndef APP-NVUE */
|
|
103
|
+
display: flex;
|
|
104
|
+
box-sizing: border-box;
|
|
105
|
+
/* #endif */
|
|
106
|
+
flex-direction: row;
|
|
107
|
+
height: 36px;
|
|
108
|
+
overflow: hidden;
|
|
109
|
+
/* #ifdef H5 */
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
/* #endif */
|
|
112
|
+
}
|
|
103
113
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
.segmented-control__item {
|
|
115
|
+
/* #ifndef APP-NVUE */
|
|
116
|
+
display: inline-flex;
|
|
117
|
+
box-sizing: border-box;
|
|
118
|
+
/* #endif */
|
|
119
|
+
position: relative;
|
|
120
|
+
flex: 1;
|
|
121
|
+
justify-content: center;
|
|
122
|
+
align-items: center;
|
|
123
|
+
}
|
|
114
124
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
.segmented-control__item--button {
|
|
126
|
+
border-style: solid;
|
|
127
|
+
border-top-width: 1px;
|
|
128
|
+
border-bottom-width: 1px;
|
|
129
|
+
border-right-width: 1px;
|
|
130
|
+
border-left-width: 0;
|
|
131
|
+
}
|
|
122
132
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
133
|
+
.segmented-control__item--button--first {
|
|
134
|
+
border-left-width: 1px;
|
|
135
|
+
border-top-left-radius: 5px;
|
|
136
|
+
border-bottom-left-radius: 5px;
|
|
137
|
+
}
|
|
128
138
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
139
|
+
.segmented-control__item--button--last {
|
|
140
|
+
border-top-right-radius: 5px;
|
|
141
|
+
border-bottom-right-radius: 5px;
|
|
142
|
+
}
|
|
133
143
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
144
|
+
.segmented-control__item--text {
|
|
145
|
+
border-bottom-style: solid;
|
|
146
|
+
border-bottom-width: 2px;
|
|
147
|
+
padding: 6px 0;
|
|
148
|
+
}
|
|
139
149
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
150
|
+
.segmented-control__text {
|
|
151
|
+
font-size: 14px;
|
|
152
|
+
line-height: 20px;
|
|
153
|
+
text-align: center;
|
|
154
|
+
}
|
|
145
155
|
</style>
|