@10yun/cv-mobile-ui 0.4.1 → 0.4.2
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/package.json +1 -1
- package/ui-cv/cv-badge/{uni-badge.vue → cv-badge.vue} +2 -2
- package/ui-cv/cv-calendar/calendar.js +762 -345
- package/ui-cv/cv-calendar/cv-calendar-item.vue +198 -0
- package/ui-cv/cv-calendar/cv-calendar.vue +508 -0
- package/ui-cv/cv-card/cv-card.vue +427 -0
- package/ui-cv/cv-col/cv-col.vue +2965 -0
- package/ui-cv/cv-collapse/cv-collapse.vue +146 -0
- package/ui-cv/cv-collapse-item/cv-collapse-item.vue +395 -0
- package/ui-cv/cv-combox/cv-combox.vue +250 -0
- package/ui-cv/cv-countdown/cv-countdown.vue +245 -0
- package/ui-cv/cv-data-checkbox/cv-data-checkbox.vue +841 -0
- package/ui-cv/cv-data-indexed-list/cv-data-indexed-list-item.vue +154 -0
- package/ui-cv/cv-data-indexed-list/cv-data-indexed-list.vue +376 -0
- package/ui-cv/cv-data-picker/cv-data-picker.vue +486 -0
- package/ui-cv/cv-data-pickerview/{uni-data-picker.js → cv-data-picker.js} +0 -0
- package/ui-cv/cv-data-pickerview/cv-data-pickerview.vue +304 -0
- package/ui-cv/cv-dateformat/cv-dateformat.vue +86 -0
- package/ui-cv/cv-datetime-picker/calendar.vue +752 -738
- package/ui-cv/cv-datetime-picker/cv-datetime-picker.vue +958 -0
- package/ui-cv/cv-datetime-picker/time-picker.vue +900 -892
- package/ui-cv/cv-easyinput/cv-easyinput.vue +514 -0
- package/ui-cv/cv-fab/cv-fab.vue +465 -0
- package/ui-cv/cv-fab/{uni-fab.vue.bak → cv-fab.vue.bak} +2 -2
- package/ui-cv/cv-fav/cv-fav.vue +150 -0
- package/ui-cv/cv-file-picker/cv-file-picker.vue +619 -0
- package/ui-cv/cv-form-item/cv-form-item.vue +1 -1
- package/ui-cv/cv-goods-nav/{uni-goods-nav.vue → cv-goods-nav.vue} +1 -1
- package/ui-cv/{cv-icons2/cv-icons2.vue → cv-icon2/cv-icon2.vue} +3 -3
- package/ui-cv/{cv-icons2 → cv-icon2}/icons.js +0 -0
- package/ui-cv/{cv-icons2 → cv-icon2}/uni.ttf +0 -0
- package/ui-cv/cv-indexed-list/cv-indexed-list-item.vue +154 -0
- package/ui-cv/cv-indexed-list/cv-indexed-list.vue +371 -0
- package/ui-cv/cv-input-password/cv-input-password.vue +2 -2
- package/ui-cv/{cv-link/uni-link.vue → cv-link2/cv-link2.vue} +1 -1
- package/ui-cv/cv-list/cv-list.vue +107 -0
- package/ui-cv/cv-list/cv-refresh.vue +65 -0
- package/ui-cv/cv-list-ad/cv-list-ad.vue +113 -0
- package/ui-cv/cv-list-chat/{uni-list-chat.scss → cv-list-chat.scss} +0 -0
- package/ui-cv/cv-list-chat/{uni-list-chat.vue → cv-list-chat.vue} +0 -0
- package/ui-cv/cv-list-item/cv-list-item.vue +449 -0
- package/ui-cv/cv-nav-bar/cv-nav-bar.vue +256 -0
- package/ui-cv/cv-nav-bar/{uni-status-bar.vue → cv-status-bar.vue} +0 -0
- package/ui-cv/cv-notice-bar/cv-notice-bar.vue +453 -0
- package/ui-cv/cv-number-box/cv-number-box.vue +223 -0
- package/ui-cv/cv-pagination/cv-pagination.vue +397 -0
- package/ui-cv/cv-popup/cv-popup.vue +429 -0
- package/ui-cv/cv-popup-dialog/{uni-popup-dialog.vue → cv-popup-dialog.vue} +0 -0
- package/ui-cv/cv-popup-message/cv-popup-message.vue +143 -0
- package/ui-cv/cv-popup-share/{uni-popup-share.vue → cv-popup-share.vue} +0 -0
- package/ui-cv/cv-row/{uni-row.vue → cv-row.vue} +1 -1
- package/ui-cv/cv-search-bar/cv-search-bar.vue +280 -0
- package/ui-cv/cv-section/{uni-section.vue → cv-section.vue} +0 -0
- package/ui-cv/cv-segmented-control/{uni-segmented-control.vue → cv-segmented-control.vue} +0 -0
- package/ui-cv/cv-status-bar/{uni-status-bar.vue → cv-status-bar.vue} +0 -0
- package/ui-cv/cv-steps/cv-steps.vue +293 -0
- package/ui-cv/cv-swipe-action/{uni-swipe-action.vue → cv-swipe-action.vue} +0 -0
- package/ui-cv/cv-swipe-action-item/{uni-swipe-action-item.vue → cv-swipe-action-item.vue} +0 -0
- package/ui-cv/cv-swiper-dot/cv-swiper-dot.vue +255 -0
- package/ui-cv/cv-table/cv-table.vue +460 -0
- package/ui-cv/cv-tag/cv-tag.vue +276 -0
- package/ui-cv/cv-tbody/cv-tbody.vue +28 -0
- package/ui-cv/cv-td/cv-td.vue +93 -0
- package/ui-cv/cv-test/{uni-test.vue → cv-test.vue} +0 -0
- package/ui-cv/cv-th/cv-th.vue +270 -0
- package/ui-cv/cv-thead/cv-thead.vue +114 -0
- package/ui-cv/cv-title/cv-title.vue +168 -0
- package/ui-cv/cv-tr/cv-tr.vue +166 -0
- package/ui-cv/cv-transition/cv-transition.vue +279 -0
- package/ui-cv/cv-calendar/uni-calendar-item.vue +0 -171
- package/ui-cv/cv-calendar/uni-calendar.vue +0 -504
- package/ui-cv/cv-card/uni-card.vue +0 -420
- package/ui-cv/cv-col/uni-col.vue +0 -2968
- package/ui-cv/cv-collapse/uni-collapse.vue +0 -146
- package/ui-cv/cv-collapse-item/uni-collapse-item.vue +0 -378
- package/ui-cv/cv-combox/uni-combox.vue +0 -237
- package/ui-cv/cv-countdown/uni-countdown.vue +0 -234
- package/ui-cv/cv-data-checkbox/uni-data-checkbox.vue +0 -792
- package/ui-cv/cv-data-indexed-list/uni-data-indexed-list-item.vue +0 -142
- package/ui-cv/cv-data-indexed-list/uni-data-indexed-list.vue +0 -364
- package/ui-cv/cv-data-picker/uni-data-picker.vue +0 -468
- package/ui-cv/cv-data-pickerview/uni-data-pickerview.vue +0 -298
- package/ui-cv/cv-dateformat/uni-dateformat.vue +0 -88
- package/ui-cv/cv-datetime-picker/uni-datetime-picker.vue +0 -874
- package/ui-cv/cv-easyinput/uni-easyinput.vue +0 -438
- package/ui-cv/cv-fab/uni-fab.vue +0 -443
- package/ui-cv/cv-fav/uni-fav.vue +0 -136
- package/ui-cv/cv-file-picker/uni-file-picker.vue +0 -614
- package/ui-cv/cv-indexed-list/uni-indexed-list-item.vue +0 -142
- package/ui-cv/cv-indexed-list/uni-indexed-list.vue +0 -357
- package/ui-cv/cv-list/uni-list.vue +0 -107
- package/ui-cv/cv-list/uni-refresh.vue +0 -65
- package/ui-cv/cv-list-ad/uni-list-ad.vue +0 -106
- package/ui-cv/cv-list-item/uni-list-item.vue +0 -428
- package/ui-cv/cv-nav-bar/uni-nav-bar.vue +0 -244
- package/ui-cv/cv-notice-bar/uni-notice-bar.vue +0 -394
- package/ui-cv/cv-number-box/uni-number-box.vue +0 -224
- package/ui-cv/cv-pagination/uni-pagination.vue +0 -376
- package/ui-cv/cv-popup/uni-popup.vue +0 -412
- package/ui-cv/cv-popup-message/uni-popup-message.vue +0 -143
- package/ui-cv/cv-search-bar/uni-search-bar.vue +0 -262
- package/ui-cv/cv-steps/uni-steps.vue +0 -250
- package/ui-cv/cv-swiper-dot/uni-swiper-dot.vue +0 -205
- package/ui-cv/cv-table/uni-table.vue +0 -455
- package/ui-cv/cv-tag/uni-tag.vue +0 -283
- package/ui-cv/cv-tbody/uni-tbody.vue +0 -30
- package/ui-cv/cv-td/uni-td.vue +0 -88
- package/ui-cv/cv-th/uni-th.vue +0 -259
- package/ui-cv/cv-thead/uni-thead.vue +0 -114
- package/ui-cv/cv-title/uni-title.vue +0 -171
- package/ui-cv/cv-tr/uni-tr.vue +0 -156
- package/ui-cv/cv-transition/uni-transition.vue +0 -287
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-cursor-point">
|
|
3
|
+
<view
|
|
4
|
+
v-if="popMenu && (leftBottom || rightBottom || leftTop || rightTop) && content.length > 0"
|
|
5
|
+
:class="{
|
|
6
|
+
'uni-fab--leftBottom': leftBottom,
|
|
7
|
+
'uni-fab--rightBottom': rightBottom,
|
|
8
|
+
'uni-fab--leftTop': leftTop,
|
|
9
|
+
'uni-fab--rightTop': rightTop
|
|
10
|
+
}"
|
|
11
|
+
class="uni-fab"
|
|
12
|
+
>
|
|
13
|
+
<view
|
|
14
|
+
:class="{
|
|
15
|
+
'uni-fab__content--left': horizontal === 'left',
|
|
16
|
+
'uni-fab__content--right': horizontal === 'right',
|
|
17
|
+
'uni-fab__content--flexDirection': direction === 'vertical',
|
|
18
|
+
'uni-fab__content--flexDirectionStart': flexDirectionStart,
|
|
19
|
+
'uni-fab__content--flexDirectionEnd': flexDirectionEnd,
|
|
20
|
+
'uni-fab__content--other-platform': !isAndroidNvue
|
|
21
|
+
}"
|
|
22
|
+
:style="{ width: boxWidth, height: boxHeight, backgroundColor: styles.backgroundColor }"
|
|
23
|
+
class="uni-fab__content"
|
|
24
|
+
elevation="5"
|
|
25
|
+
>
|
|
26
|
+
<view v-if="flexDirectionStart || horizontalLeft" class="uni-fab__item uni-fab__item--first" />
|
|
27
|
+
<view
|
|
28
|
+
v-for="(item, index) in content"
|
|
29
|
+
:key="index"
|
|
30
|
+
:class="{ 'uni-fab__item--active': isShow }"
|
|
31
|
+
class="uni-fab__item"
|
|
32
|
+
@click="_onItemClick(index, item)"
|
|
33
|
+
>
|
|
34
|
+
<image :src="item.active ? item.selectedIconPath : item.iconPath" class="uni-fab__item-image" mode="widthFix" />
|
|
35
|
+
<text class="uni-fab__item-text" :style="{ color: item.active ? styles.selectedColor : styles.color }">
|
|
36
|
+
{{ item.text }}
|
|
37
|
+
</text>
|
|
38
|
+
</view>
|
|
39
|
+
<view v-if="flexDirectionEnd || horizontalRight" class="uni-fab__item uni-fab__item--first" />
|
|
40
|
+
</view>
|
|
41
|
+
</view>
|
|
42
|
+
<view
|
|
43
|
+
:class="{
|
|
44
|
+
'uni-fab__circle--leftBottom': leftBottom,
|
|
45
|
+
'uni-fab__circle--rightBottom': rightBottom,
|
|
46
|
+
'uni-fab__circle--leftTop': leftTop,
|
|
47
|
+
'uni-fab__circle--rightTop': rightTop,
|
|
48
|
+
'uni-fab__content--other-platform': !isAndroidNvue
|
|
49
|
+
}"
|
|
50
|
+
class="uni-fab__circle uni-fab__plus"
|
|
51
|
+
:style="{ 'background-color': styles.buttonColor }"
|
|
52
|
+
@click="_onClick"
|
|
53
|
+
>
|
|
54
|
+
<view class="fab-circle-v" :class="{ 'uni-fab__plus--active': isShow && content.length > 0 }"></view>
|
|
55
|
+
<view class="fab-circle-h" :class="{ 'uni-fab__plus--active': isShow && content.length > 0 }"></view>
|
|
56
|
+
</view>
|
|
57
|
+
</view>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script>
|
|
61
|
+
let platform = 'other';
|
|
62
|
+
// #ifdef APP-NVUE
|
|
63
|
+
platform = uni.getSystemInfoSync().platform;
|
|
64
|
+
// #endif
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Fab 悬浮按钮
|
|
68
|
+
* @description 点击可展开一个图形按钮菜单
|
|
69
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=144
|
|
70
|
+
* @property {Object} pattern 可选样式配置项
|
|
71
|
+
* @property {Object} horizontal = [left | right] 水平对齐方式
|
|
72
|
+
* @value left 左对齐
|
|
73
|
+
* @value right 右对齐
|
|
74
|
+
* @property {Object} vertical = [bottom | top] 垂直对齐方式
|
|
75
|
+
* @value bottom 下对齐
|
|
76
|
+
* @value top 上对齐
|
|
77
|
+
* @property {Object} direction = [horizontal | vertical] 展开菜单显示方式
|
|
78
|
+
* @value horizontal 水平显示
|
|
79
|
+
* @value vertical 垂直显示
|
|
80
|
+
* @property {Array} content 展开菜单内容配置项
|
|
81
|
+
* @property {Boolean} popMenu 是否使用弹出菜单
|
|
82
|
+
* @event {Function} trigger 展开菜单点击事件,返回点击信息
|
|
83
|
+
* @event {Function} fabClick 悬浮按钮点击事件
|
|
84
|
+
*/
|
|
85
|
+
export default {
|
|
86
|
+
name: 'cvFab',
|
|
87
|
+
emits: ['fabClick', 'trigger'],
|
|
88
|
+
props: {
|
|
89
|
+
pattern: {
|
|
90
|
+
type: Object,
|
|
91
|
+
default() {
|
|
92
|
+
return {};
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
horizontal: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: 'left'
|
|
98
|
+
},
|
|
99
|
+
vertical: {
|
|
100
|
+
type: String,
|
|
101
|
+
default: 'bottom'
|
|
102
|
+
},
|
|
103
|
+
direction: {
|
|
104
|
+
type: String,
|
|
105
|
+
default: 'horizontal'
|
|
106
|
+
},
|
|
107
|
+
content: {
|
|
108
|
+
type: Array,
|
|
109
|
+
default() {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
show: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
default: false
|
|
116
|
+
},
|
|
117
|
+
popMenu: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
default: true
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
data() {
|
|
123
|
+
return {
|
|
124
|
+
fabShow: false,
|
|
125
|
+
isShow: false,
|
|
126
|
+
isAndroidNvue: platform === 'android',
|
|
127
|
+
styles: {
|
|
128
|
+
color: '#3c3e49',
|
|
129
|
+
selectedColor: '#007AFF',
|
|
130
|
+
backgroundColor: '#fff',
|
|
131
|
+
buttonColor: '#007AFF'
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
},
|
|
135
|
+
computed: {
|
|
136
|
+
contentWidth(e) {
|
|
137
|
+
return (this.content.length + 1) * 55 + 10 + 'px';
|
|
138
|
+
},
|
|
139
|
+
contentWidthMin() {
|
|
140
|
+
return 55 + 'px';
|
|
141
|
+
},
|
|
142
|
+
// 动态计算宽度
|
|
143
|
+
boxWidth() {
|
|
144
|
+
return this.getPosition(3, 'horizontal');
|
|
145
|
+
},
|
|
146
|
+
// 动态计算高度
|
|
147
|
+
boxHeight() {
|
|
148
|
+
return this.getPosition(3, 'vertical');
|
|
149
|
+
},
|
|
150
|
+
// 计算左下位置
|
|
151
|
+
leftBottom() {
|
|
152
|
+
return this.getPosition(0, 'left', 'bottom');
|
|
153
|
+
},
|
|
154
|
+
// 计算右下位置
|
|
155
|
+
rightBottom() {
|
|
156
|
+
return this.getPosition(0, 'right', 'bottom');
|
|
157
|
+
},
|
|
158
|
+
// 计算左上位置
|
|
159
|
+
leftTop() {
|
|
160
|
+
return this.getPosition(0, 'left', 'top');
|
|
161
|
+
},
|
|
162
|
+
rightTop() {
|
|
163
|
+
return this.getPosition(0, 'right', 'top');
|
|
164
|
+
},
|
|
165
|
+
flexDirectionStart() {
|
|
166
|
+
return this.getPosition(1, 'vertical', 'top');
|
|
167
|
+
},
|
|
168
|
+
flexDirectionEnd() {
|
|
169
|
+
return this.getPosition(1, 'vertical', 'bottom');
|
|
170
|
+
},
|
|
171
|
+
horizontalLeft() {
|
|
172
|
+
return this.getPosition(2, 'horizontal', 'left');
|
|
173
|
+
},
|
|
174
|
+
horizontalRight() {
|
|
175
|
+
return this.getPosition(2, 'horizontal', 'right');
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
watch: {
|
|
179
|
+
pattern(newValue, oldValue) {
|
|
180
|
+
//console.log(JSON.stringify(newValue))
|
|
181
|
+
this.styles = Object.assign({}, this.styles, newValue);
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
created() {
|
|
185
|
+
this.isShow = this.show;
|
|
186
|
+
if (this.top === 0) {
|
|
187
|
+
this.fabShow = true;
|
|
188
|
+
}
|
|
189
|
+
// 初始化样式
|
|
190
|
+
this.styles = Object.assign({}, this.styles, this.pattern);
|
|
191
|
+
},
|
|
192
|
+
methods: {
|
|
193
|
+
_onClick() {
|
|
194
|
+
this.$emit('fabClick');
|
|
195
|
+
if (!this.popMenu) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
this.isShow = !this.isShow;
|
|
199
|
+
},
|
|
200
|
+
open() {
|
|
201
|
+
this.isShow = true;
|
|
202
|
+
},
|
|
203
|
+
close() {
|
|
204
|
+
this.isShow = false;
|
|
205
|
+
},
|
|
206
|
+
/**
|
|
207
|
+
* 按钮点击事件
|
|
208
|
+
*/
|
|
209
|
+
_onItemClick(index, item) {
|
|
210
|
+
this.$emit('trigger', {
|
|
211
|
+
index,
|
|
212
|
+
item
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
/**
|
|
216
|
+
* 获取 位置信息
|
|
217
|
+
*/
|
|
218
|
+
getPosition(types, paramA, paramB) {
|
|
219
|
+
if (types === 0) {
|
|
220
|
+
return this.horizontal === paramA && this.vertical === paramB;
|
|
221
|
+
} else if (types === 1) {
|
|
222
|
+
return this.direction === paramA && this.vertical === paramB;
|
|
223
|
+
} else if (types === 2) {
|
|
224
|
+
return this.direction === paramA && this.horizontal === paramB;
|
|
225
|
+
} else {
|
|
226
|
+
return this.isShow && this.direction === paramA ? this.contentWidth : this.contentWidthMin;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
</script>
|
|
232
|
+
|
|
233
|
+
<style scoped>
|
|
234
|
+
.uni-fab {
|
|
235
|
+
position: fixed;
|
|
236
|
+
/* #ifndef APP-NVUE */
|
|
237
|
+
display: flex;
|
|
238
|
+
/* #endif */
|
|
239
|
+
justify-content: center;
|
|
240
|
+
align-items: center;
|
|
241
|
+
z-index: 10;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.uni-cursor-point {
|
|
245
|
+
/* #ifdef H5 */
|
|
246
|
+
cursor: pointer;
|
|
247
|
+
/* #endif */
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.uni-fab--active {
|
|
251
|
+
opacity: 1;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.uni-fab--leftBottom {
|
|
255
|
+
left: 5px;
|
|
256
|
+
bottom: 20px;
|
|
257
|
+
/* #ifdef H5 */
|
|
258
|
+
left: calc(5px + var(--window-left));
|
|
259
|
+
bottom: calc(20px + var(--window-bottom));
|
|
260
|
+
/* #endif */
|
|
261
|
+
padding: 10px;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.uni-fab--leftTop {
|
|
265
|
+
left: 5px;
|
|
266
|
+
top: 30px;
|
|
267
|
+
/* #ifdef H5 */
|
|
268
|
+
left: calc(5px + var(--window-left));
|
|
269
|
+
top: calc(30px + var(--window-top));
|
|
270
|
+
/* #endif */
|
|
271
|
+
padding: 10px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.uni-fab--rightBottom {
|
|
275
|
+
right: 5px;
|
|
276
|
+
bottom: 20px;
|
|
277
|
+
/* #ifdef H5 */
|
|
278
|
+
right: calc(5px + var(--window-right));
|
|
279
|
+
bottom: calc(20px + var(--window-bottom));
|
|
280
|
+
/* #endif */
|
|
281
|
+
padding: 10px;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.uni-fab--rightTop {
|
|
285
|
+
right: 5px;
|
|
286
|
+
top: 30px;
|
|
287
|
+
/* #ifdef H5 */
|
|
288
|
+
right: calc(5px + var(--window-right));
|
|
289
|
+
top: calc(30px + var(--window-top));
|
|
290
|
+
/* #endif */
|
|
291
|
+
padding: 10px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.uni-fab__circle {
|
|
295
|
+
position: fixed;
|
|
296
|
+
/* #ifndef APP-NVUE */
|
|
297
|
+
display: flex;
|
|
298
|
+
/* #endif */
|
|
299
|
+
justify-content: center;
|
|
300
|
+
align-items: center;
|
|
301
|
+
width: 55px;
|
|
302
|
+
height: 55px;
|
|
303
|
+
background-color: #3c3e49;
|
|
304
|
+
border-radius: 55px;
|
|
305
|
+
z-index: 11;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.uni-fab__circle--leftBottom {
|
|
309
|
+
left: 15px;
|
|
310
|
+
bottom: 30px;
|
|
311
|
+
/* #ifdef H5 */
|
|
312
|
+
left: calc(15px + var(--window-left));
|
|
313
|
+
bottom: calc(30px + var(--window-bottom));
|
|
314
|
+
/* #endif */
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.uni-fab__circle--leftTop {
|
|
318
|
+
left: 15px;
|
|
319
|
+
top: 40px;
|
|
320
|
+
/* #ifdef H5 */
|
|
321
|
+
left: calc(15px + var(--window-left));
|
|
322
|
+
top: calc(40px + var(--window-top));
|
|
323
|
+
/* #endif */
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.uni-fab__circle--rightBottom {
|
|
327
|
+
right: 15px;
|
|
328
|
+
bottom: 30px;
|
|
329
|
+
/* #ifdef H5 */
|
|
330
|
+
right: calc(15px + var(--window-right));
|
|
331
|
+
bottom: calc(30px + var(--window-bottom));
|
|
332
|
+
/* #endif */
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.uni-fab__circle--rightTop {
|
|
336
|
+
right: 15px;
|
|
337
|
+
top: 40px;
|
|
338
|
+
/* #ifdef H5 */
|
|
339
|
+
right: calc(15px + var(--window-right));
|
|
340
|
+
top: calc(40px + var(--window-top));
|
|
341
|
+
/* #endif */
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.uni-fab__circle--left {
|
|
345
|
+
left: 0;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.uni-fab__circle--right {
|
|
349
|
+
right: 0;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.uni-fab__circle--top {
|
|
353
|
+
top: 0;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.uni-fab__circle--bottom {
|
|
357
|
+
bottom: 0;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.uni-fab__plus {
|
|
361
|
+
font-weight: bold;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.fab-circle-v {
|
|
365
|
+
position: absolute;
|
|
366
|
+
width: 3px;
|
|
367
|
+
height: 31px;
|
|
368
|
+
left: 26px;
|
|
369
|
+
top: 12px;
|
|
370
|
+
background-color: white;
|
|
371
|
+
transform: rotate(0deg);
|
|
372
|
+
transition: transform 0.3s;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.fab-circle-h {
|
|
376
|
+
position: absolute;
|
|
377
|
+
width: 31px;
|
|
378
|
+
height: 3px;
|
|
379
|
+
left: 12px;
|
|
380
|
+
top: 26px;
|
|
381
|
+
background-color: white;
|
|
382
|
+
transform: rotate(0deg);
|
|
383
|
+
transition: transform 0.3s;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.uni-fab__plus--active {
|
|
387
|
+
transform: rotate(135deg);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.uni-fab__content {
|
|
391
|
+
/* #ifndef APP-NVUE */
|
|
392
|
+
box-sizing: border-box;
|
|
393
|
+
display: flex;
|
|
394
|
+
/* #endif */
|
|
395
|
+
flex-direction: row;
|
|
396
|
+
border-radius: 55px;
|
|
397
|
+
overflow: hidden;
|
|
398
|
+
transition-property: width, height;
|
|
399
|
+
transition-duration: 0.2s;
|
|
400
|
+
width: 55px;
|
|
401
|
+
border-color: #dddddd;
|
|
402
|
+
border-width: 1rpx;
|
|
403
|
+
border-style: solid;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.uni-fab__content--other-platform {
|
|
407
|
+
border-width: 0px;
|
|
408
|
+
box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.2);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.uni-fab__content--left {
|
|
412
|
+
justify-content: flex-start;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.uni-fab__content--right {
|
|
416
|
+
justify-content: flex-end;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.uni-fab__content--flexDirection {
|
|
420
|
+
flex-direction: column;
|
|
421
|
+
justify-content: flex-end;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.uni-fab__content--flexDirectionStart {
|
|
425
|
+
flex-direction: column;
|
|
426
|
+
justify-content: flex-start;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.uni-fab__content--flexDirectionEnd {
|
|
430
|
+
flex-direction: column;
|
|
431
|
+
justify-content: flex-end;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.uni-fab__item {
|
|
435
|
+
/* #ifndef APP-NVUE */
|
|
436
|
+
display: flex;
|
|
437
|
+
/* #endif */
|
|
438
|
+
flex-direction: column;
|
|
439
|
+
justify-content: center;
|
|
440
|
+
align-items: center;
|
|
441
|
+
width: 55px;
|
|
442
|
+
height: 55px;
|
|
443
|
+
opacity: 0;
|
|
444
|
+
transition: opacity 0.2s;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.uni-fab__item--active {
|
|
448
|
+
opacity: 1;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.uni-fab__item-image {
|
|
452
|
+
width: 25px;
|
|
453
|
+
height: 25px;
|
|
454
|
+
margin-bottom: 3px;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.uni-fab__item-text {
|
|
458
|
+
color: #ffffff;
|
|
459
|
+
font-size: 12px;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.uni-fab__item--first {
|
|
463
|
+
width: 55px;
|
|
464
|
+
}
|
|
465
|
+
</style>
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
</template>
|
|
39
39
|
|
|
40
40
|
<script>
|
|
41
|
-
import
|
|
41
|
+
import cvIcon2 from "../cv-icon2/cv-icon2.vue";
|
|
42
42
|
export default {
|
|
43
43
|
name: 'UniFab',
|
|
44
44
|
components: {
|
|
45
|
-
|
|
45
|
+
cvIcon2
|
|
46
46
|
},
|
|
47
47
|
props: {
|
|
48
48
|
pattern: {
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
:class="[circle === true || circle === 'true' ? 'uni-fav--circle' : '']"
|
|
4
|
+
:style="[{ backgroundColor: checked ? bgColorChecked : bgColor }]"
|
|
5
|
+
@click="onClick"
|
|
6
|
+
class="uni-fav"
|
|
7
|
+
>
|
|
8
|
+
<!-- #ifdef MP-ALIPAY -->
|
|
9
|
+
<view class="uni-fav-star" v-if="!checked && (star === true || star === 'true')">
|
|
10
|
+
<cv-icon2 :color="fgColor" :style="{ color: checked ? fgColorChecked : fgColor }" size="14" type="star-filled" />
|
|
11
|
+
</view>
|
|
12
|
+
<!-- #endif -->
|
|
13
|
+
<!-- #ifndef MP-ALIPAY -->
|
|
14
|
+
<cv-icon2
|
|
15
|
+
:color="fgColor"
|
|
16
|
+
:style="{ color: checked ? fgColorChecked : fgColor }"
|
|
17
|
+
class="uni-fav-star"
|
|
18
|
+
size="14"
|
|
19
|
+
type="star-filled"
|
|
20
|
+
v-if="!checked && (star === true || star === 'true')"
|
|
21
|
+
/>
|
|
22
|
+
<!-- #endif -->
|
|
23
|
+
<text :style="{ color: checked ? fgColorChecked : fgColor }" class="uni-fav-text">
|
|
24
|
+
{{ checked ? contentText.contentFav : contentText.contentDefault }}
|
|
25
|
+
</text>
|
|
26
|
+
</view>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
/**
|
|
31
|
+
* Fav 收藏按钮
|
|
32
|
+
* @description 用于收藏功能,可点击切换选中、不选中的状态
|
|
33
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=864
|
|
34
|
+
* @property {Boolean} star = [true|false] 按钮是否带星星
|
|
35
|
+
* @property {String} bgColor 未收藏时的背景色
|
|
36
|
+
* @property {String} bgColorChecked 已收藏时的背景色
|
|
37
|
+
* @property {String} fgColor 未收藏时的文字颜色
|
|
38
|
+
* @property {String} fgColorChecked 已收藏时的文字颜色
|
|
39
|
+
* @property {Boolean} circle = [true|false] 是否为圆角
|
|
40
|
+
* @property {Boolean} checked = [true|false] 是否为已收藏
|
|
41
|
+
* @property {Object} contentText = [true|false] 收藏按钮文字
|
|
42
|
+
* @event {Function} click 点击 fav按钮触发事件
|
|
43
|
+
* @example <uni-fav :checked="true"/>
|
|
44
|
+
*/
|
|
45
|
+
export default {
|
|
46
|
+
name: 'cvFav',
|
|
47
|
+
// TODO 兼容 vue3,需要注册事件
|
|
48
|
+
emits: ['click'],
|
|
49
|
+
props: {
|
|
50
|
+
star: {
|
|
51
|
+
type: [Boolean, String],
|
|
52
|
+
default: true
|
|
53
|
+
},
|
|
54
|
+
bgColor: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: '#eeeeee'
|
|
57
|
+
},
|
|
58
|
+
fgColor: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: '#666666'
|
|
61
|
+
},
|
|
62
|
+
bgColorChecked: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: '#007aff'
|
|
65
|
+
},
|
|
66
|
+
fgColorChecked: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: '#FFFFFF'
|
|
69
|
+
},
|
|
70
|
+
circle: {
|
|
71
|
+
type: [Boolean, String],
|
|
72
|
+
default: false
|
|
73
|
+
},
|
|
74
|
+
checked: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: false
|
|
77
|
+
},
|
|
78
|
+
contentText: {
|
|
79
|
+
type: Object,
|
|
80
|
+
default() {
|
|
81
|
+
return {
|
|
82
|
+
contentDefault: '收藏',
|
|
83
|
+
contentFav: '已收藏'
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
watch: {
|
|
89
|
+
checked() {
|
|
90
|
+
if (uni.report) {
|
|
91
|
+
if (this.checked) {
|
|
92
|
+
uni.report('收藏', '收藏');
|
|
93
|
+
} else {
|
|
94
|
+
uni.report('取消收藏', '取消收藏');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
methods: {
|
|
100
|
+
onClick() {
|
|
101
|
+
this.$emit('click');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<style scoped>
|
|
108
|
+
.uni-fav {
|
|
109
|
+
/* #ifndef APP-NVUE */
|
|
110
|
+
display: flex;
|
|
111
|
+
/* #endif */
|
|
112
|
+
flex-direction: row;
|
|
113
|
+
align-items: center;
|
|
114
|
+
justify-content: center;
|
|
115
|
+
width: 60px;
|
|
116
|
+
height: 25px;
|
|
117
|
+
line-height: 25px;
|
|
118
|
+
text-align: center;
|
|
119
|
+
border-radius: 3px;
|
|
120
|
+
/* #ifdef H5 */
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
/* #endif */
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.uni-fav--circle {
|
|
126
|
+
border-radius: 30px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.uni-fav-star {
|
|
130
|
+
/* #ifndef APP-NVUE */
|
|
131
|
+
display: flex;
|
|
132
|
+
/* #endif */
|
|
133
|
+
height: 25px;
|
|
134
|
+
line-height: 24px;
|
|
135
|
+
margin-right: 3px;
|
|
136
|
+
align-items: center;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.uni-fav-text {
|
|
141
|
+
/* #ifndef APP-NVUE */
|
|
142
|
+
display: flex;
|
|
143
|
+
/* #endif */
|
|
144
|
+
height: 25px;
|
|
145
|
+
line-height: 25px;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
font-size: 14px;
|
|
149
|
+
}
|
|
150
|
+
</style>
|