@10yun/cv-mobile-ui 0.5.20 → 0.5.21
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/components/cv-grid-item/cv-grid-item.vue +1 -1
- package/uni-ui/lib/uni-badge/uni-badge.vue +150 -1
- package/uni-ui/lib/uni-breadcrumb/uni-breadcrumb.vue +37 -1
- package/uni-ui/lib/uni-breadcrumb-item/uni-breadcrumb-item.vue +83 -1
- package/uni-ui/lib/uni-calendar/uni-calendar-item.vue +122 -1
- package/uni-ui/lib/uni-calendar/uni-calendar.vue +366 -1
- package/uni-ui/lib/uni-card/uni-card.vue +124 -1
- package/uni-ui/lib/uni-col/uni-col.vue +1 -1
- package/uni-ui/lib/uni-collapse/uni-collapse.vue +135 -1
- package/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +266 -1
- package/uni-ui/lib/uni-combox/uni-combox.vue +1 -1
- package/uni-ui/lib/uni-countdown/uni-countdown.vue +239 -1
- package/uni-ui/lib/uni-data-checkbox/uni-data-checkbox.vue +487 -1
- package/uni-ui/lib/uni-data-picker/uni-data-picker.vue +530 -1
- package/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +157 -150
- package/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +166 -1
- package/uni-ui/lib/uni-data-select/uni-data-select.vue +289 -1
- package/uni-ui/lib/uni-datetime-picker/calendar-item.vue +70 -1
- package/uni-ui/lib/uni-datetime-picker/calendar.vue +629 -1
- package/uni-ui/lib/uni-datetime-picker/time-picker.vue +741 -1
- package/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +847 -1
- package/uni-ui/lib/uni-drawer/uni-drawer.vue +115 -1
- package/uni-ui/lib/uni-easyinput/uni-easyinput.vue +515 -1
- package/uni-ui/lib/uni-fab/uni-fab.vue +257 -1
- package/uni-ui/lib/uni-fav/uni-fav.vue +123 -1
- package/uni-ui/lib/uni-file-picker/uni-file-picker.vue +642 -1
- package/uni-ui/lib/uni-file-picker/upload-file.vue +177 -1
- package/uni-ui/lib/uni-file-picker/upload-image.vue +176 -1
- package/uni-ui/lib/uni-forms/uni-forms.vue +375 -1
- package/uni-ui/lib/uni-forms-item/uni-forms-item.vue +429 -1
- package/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +129 -1
- package/uni-ui/lib/uni-grid/uni-grid.vue +115 -1
- package/uni-ui/lib/uni-grid-item/uni-grid-item.vue +78 -1
- package/uni-ui/lib/uni-group/uni-group.vue +85 -1
- package/uni-ui/lib/uni-icons/uni-icons.vue +85 -1
- package/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +68 -1
- package/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +294 -1
- package/uni-ui/lib/uni-list/uni-list.vue +81 -1
- package/uni-ui/lib/uni-list-ad/uni-list-ad.vue +77 -1
- package/uni-ui/lib/uni-list-chat/uni-list-chat.vue +294 -1
- package/uni-ui/lib/uni-list-item/uni-list-item.vue +346 -1
- package/uni-ui/lib/uni-load-more/uni-load-more.vue +172 -1
- package/uni-ui/lib/uni-nav-bar/uni-nav-bar.vue +205 -1
- package/uni-ui/lib/uni-nav-bar/uni-status-bar.vue +18 -1
- package/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +331 -1
- package/uni-ui/lib/uni-number-box/uni-number-box.vue +166 -1
- package/uni-ui/lib/uni-pagination/uni-pagination.vue +323 -1
- package/uni-ui/lib/uni-popup/uni-popup.vue +1 -1
- package/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +173 -1
- package/uni-ui/lib/uni-popup-message/uni-popup-message.vue +74 -1
- package/uni-ui/lib/uni-popup-share/uni-popup-share.vue +106 -1
- package/uni-ui/lib/uni-rate/uni-rate.vue +322 -1
- package/uni-ui/lib/uni-row/uni-row.vue +1 -1
- package/uni-ui/lib/uni-search-bar/uni-search-bar.vue +236 -1
- package/uni-ui/lib/uni-section/uni-section.vue +109 -1
- package/uni-ui/lib/uni-segmented-control/uni-segmented-control.vue +103 -1
- package/uni-ui/lib/uni-status-bar/uni-status-bar.vue +1 -1
- package/uni-ui/lib/uni-steps/uni-steps.vue +120 -1
- package/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +226 -3
- package/uni-ui/lib/uni-swiper-dot/uni-swiper-dot.vue +167 -1
- package/uni-ui/lib/uni-table/uni-table.vue +297 -1
- package/uni-ui/lib/uni-tag/uni-tag.vue +100 -1
- package/uni-ui/lib/uni-td/uni-td.vue +78 -1
- package/uni-ui/lib/uni-th/filter-dropdown.vue +1 -1
- package/uni-ui/lib/uni-th/uni-th.vue +224 -1
- package/uni-ui/lib/uni-thead/uni-thead.vue +77 -1
- package/uni-ui/lib/uni-tr/table-checkbox.vue +79 -1
- package/uni-ui/lib/uni-tr/uni-tr.vue +135 -1
package/package.json
CHANGED
|
@@ -1 +1,150 @@
|
|
|
1
|
-
<template>
|
|
2
1
|
<view class="uni-badge--x">
|
|
3
2
|
<slot />
|
|
4
3
|
<text v-if="text" :class="classNames" :style="[positionStyle, customStyle, dotStyle]" class="uni-badge" @click="onClick()">
|
|
5
4
|
{{ displayValue }}
|
|
6
5
|
</text>
|
|
7
6
|
</view>
|
|
8
7
|
* Badge 数字角标
|
|
9
8
|
* @description 数字角标一般和其它控件(列表、9宫格等)配合使用,用于进行数量提示,默认为实心灰色背景
|
|
10
9
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=21
|
|
11
10
|
* @property {String} text 角标内容
|
|
12
11
|
* @property {String} size = [normal|small] 角标内容
|
|
13
12
|
* @property {String} type = [info|primary|success|warning|error] 颜色类型
|
|
14
13
|
* @value info 灰色
|
|
15
14
|
* @value primary 蓝色
|
|
16
15
|
* @value success 绿色
|
|
17
16
|
* @value warning 黄色
|
|
18
17
|
* @value error 红色
|
|
19
18
|
* @property {String} inverted = [true|false] 是否无需背景颜色
|
|
20
19
|
* @property {Number} maxNum 展示封顶的数字值,超过 99 显示 99+
|
|
21
20
|
* @property {String} absolute = [rightTop|rightBottom|leftBottom|leftTop] 开启绝对定位, 角标将定位到其包裹的标签的四角上
|
|
22
21
|
* @value rightTop 右上
|
|
23
22
|
* @value rightBottom 右下
|
|
24
23
|
* @value leftTop 左上
|
|
25
24
|
* @value leftBottom 左下
|
|
26
25
|
* @property {Array[number]} offset 距定位角中心点的偏移量,只有存在 absolute 属性时有效,例如:[-10, -10] 表示向外偏移 10px,[10, 10] 表示向 absolute 指定的内偏移 10px
|
|
27
26
|
* @property {String} isDot = [true|false] 是否显示为一个小点
|
|
28
27
|
* @event {Function} click 点击 Badge 触发事件
|
|
29
28
|
* @example <uni-badge text="1"></uni-badge>
|
|
30
29
|
*/
|
|
31
30
|
name: 'UniBadge',
|
|
32
31
|
emits: ['click'],
|
|
33
32
|
props: {
|
|
34
33
|
type: {
|
|
35
34
|
type: String,
|
|
36
35
|
default: 'error'
|
|
37
36
|
},
|
|
38
37
|
inverted: {
|
|
39
38
|
type: Boolean,
|
|
40
39
|
default: false
|
|
41
40
|
},
|
|
42
41
|
isDot: {
|
|
43
42
|
type: Boolean,
|
|
44
43
|
default: false
|
|
45
44
|
},
|
|
46
45
|
maxNum: {
|
|
47
46
|
type: Number,
|
|
48
47
|
default: 99
|
|
49
48
|
},
|
|
50
49
|
absolute: {
|
|
51
50
|
type: String,
|
|
52
51
|
default: ''
|
|
53
52
|
},
|
|
54
53
|
offset: {
|
|
55
54
|
type: Array,
|
|
56
55
|
default() {
|
|
57
56
|
return [0, 0];
|
|
58
57
|
}
|
|
59
58
|
},
|
|
60
59
|
text: {
|
|
61
60
|
type: [String, Number],
|
|
62
61
|
default: ''
|
|
63
62
|
},
|
|
64
63
|
size: {
|
|
65
64
|
type: String,
|
|
66
65
|
default: 'small'
|
|
67
66
|
},
|
|
68
67
|
customStyle: {
|
|
69
68
|
type: Object,
|
|
70
69
|
default() {
|
|
71
70
|
return {};
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
73
|
},
|
|
75
74
|
data() {
|
|
76
75
|
return {};
|
|
77
76
|
},
|
|
78
77
|
computed: {
|
|
79
78
|
width() {
|
|
80
79
|
return String(this.text).length * 8 + 12;
|
|
81
80
|
},
|
|
82
81
|
classNames() {
|
|
83
82
|
const { inverted, type, size, absolute } = this;
|
|
84
83
|
return [
|
|
85
84
|
inverted ? 'uni-badge--' + type + '-inverted' : '',
|
|
86
85
|
'uni-badge--' + type,
|
|
87
86
|
'uni-badge--' + size,
|
|
88
87
|
absolute ? 'uni-badge--absolute' : ''
|
|
89
88
|
].join(' ');
|
|
90
89
|
},
|
|
91
90
|
positionStyle() {
|
|
92
91
|
if (!this.absolute) return {};
|
|
93
92
|
let w = this.width / 2,
|
|
94
93
|
h = 10;
|
|
95
94
|
if (this.isDot) {
|
|
96
95
|
w = 5;
|
|
97
96
|
h = 5;
|
|
98
97
|
}
|
|
99
98
|
const x = `${-w + this.offset[0]}px`;
|
|
100
99
|
const y = `${-h + this.offset[1]}px`;
|
|
101
100
|
const whiteList = {
|
|
102
101
|
rightTop: {
|
|
103
102
|
right: x,
|
|
104
103
|
top: y
|
|
105
104
|
},
|
|
106
105
|
rightBottom: {
|
|
107
106
|
right: x,
|
|
108
107
|
bottom: y
|
|
109
108
|
},
|
|
110
109
|
leftBottom: {
|
|
111
110
|
left: x,
|
|
112
111
|
bottom: y
|
|
113
112
|
},
|
|
114
113
|
leftTop: {
|
|
115
114
|
left: x,
|
|
116
115
|
top: y
|
|
117
116
|
}
|
|
118
117
|
};
|
|
119
118
|
const match = whiteList[this.absolute];
|
|
120
119
|
return match ? match : whiteList['rightTop'];
|
|
121
120
|
},
|
|
122
121
|
dotStyle() {
|
|
123
122
|
if (!this.isDot) return {};
|
|
124
123
|
return {
|
|
125
124
|
width: '10px',
|
|
126
125
|
minWidth: '0',
|
|
127
126
|
height: '10px',
|
|
128
127
|
padding: '0',
|
|
129
128
|
borderRadius: '10px'
|
|
130
129
|
};
|
|
131
130
|
},
|
|
132
131
|
displayValue() {
|
|
133
132
|
const { isDot, text, maxNum } = this;
|
|
134
133
|
return isDot ? '' : Number(text) > maxNum ? `${maxNum}+` : text;
|
|
135
134
|
}
|
|
136
135
|
},
|
|
137
136
|
methods: {
|
|
138
137
|
onClick() {
|
|
139
138
|
this.$emit('click');
|
|
140
139
|
}
|
|
141
140
|
}
|
|
141
|
+
<template>
|
|
142
|
+
<view class="uni-badge--x">
|
|
143
|
+
<slot />
|
|
144
|
+
<text v-if="text" :class="classNames" :style="[positionStyle, customStyle, dotStyle]" class="uni-badge" @click="onClick()">
|
|
145
|
+
{{ displayValue }}
|
|
146
|
+
</text>
|
|
147
|
+
</view>
|
|
148
|
+
</template>
|
|
149
|
+
<script>
|
|
150
|
+
/**
|
|
151
|
+
* Badge 数字角标
|
|
152
|
+
* @description 数字角标一般和其它控件(列表、9宫格等)配合使用,用于进行数量提示,默认为实心灰色背景
|
|
153
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=21
|
|
154
|
+
* @property {String} text 角标内容
|
|
155
|
+
* @property {String} size = [normal|small] 角标内容
|
|
156
|
+
* @property {String} type = [info|primary|success|warning|error] 颜色类型
|
|
157
|
+
* @value info 灰色
|
|
158
|
+
* @value primary 蓝色
|
|
159
|
+
* @value success 绿色
|
|
160
|
+
* @value warning 黄色
|
|
161
|
+
* @value error 红色
|
|
162
|
+
* @property {String} inverted = [true|false] 是否无需背景颜色
|
|
163
|
+
* @property {Number} maxNum 展示封顶的数字值,超过 99 显示 99+
|
|
164
|
+
* @property {String} absolute = [rightTop|rightBottom|leftBottom|leftTop] 开启绝对定位, 角标将定位到其包裹的标签的四角上
|
|
165
|
+
* @value rightTop 右上
|
|
166
|
+
* @value rightBottom 右下
|
|
167
|
+
* @value leftTop 左上
|
|
168
|
+
* @value leftBottom 左下
|
|
169
|
+
* @property {Array[number]} offset 距定位角中心点的偏移量,只有存在 absolute 属性时有效,例如:[-10, -10] 表示向外偏移 10px,[10, 10] 表示向 absolute 指定的内偏移 10px
|
|
170
|
+
* @property {String} isDot = [true|false] 是否显示为一个小点
|
|
171
|
+
* @event {Function} click 点击 Badge 触发事件
|
|
172
|
+
* @example <uni-badge text="1"></uni-badge>
|
|
173
|
+
*/
|
|
174
|
+
export default {
|
|
175
|
+
name: 'UniBadge',
|
|
176
|
+
emits: ['click'],
|
|
177
|
+
props: {
|
|
178
|
+
type: {
|
|
179
|
+
type: String,
|
|
180
|
+
default: 'error'
|
|
181
|
+
},
|
|
182
|
+
inverted: {
|
|
183
|
+
type: Boolean,
|
|
184
|
+
default: false
|
|
185
|
+
},
|
|
186
|
+
isDot: {
|
|
187
|
+
type: Boolean,
|
|
188
|
+
default: false
|
|
189
|
+
},
|
|
190
|
+
maxNum: {
|
|
191
|
+
type: Number,
|
|
192
|
+
default: 99
|
|
193
|
+
},
|
|
194
|
+
absolute: {
|
|
195
|
+
type: String,
|
|
196
|
+
default: ''
|
|
197
|
+
},
|
|
198
|
+
offset: {
|
|
199
|
+
type: Array,
|
|
200
|
+
default() {
|
|
201
|
+
return [0, 0];
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
text: {
|
|
205
|
+
type: [String, Number],
|
|
206
|
+
default: ''
|
|
207
|
+
},
|
|
208
|
+
size: {
|
|
209
|
+
type: String,
|
|
210
|
+
default: 'small'
|
|
211
|
+
},
|
|
212
|
+
customStyle: {
|
|
213
|
+
type: Object,
|
|
214
|
+
default() {
|
|
215
|
+
return {};
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
data() {
|
|
220
|
+
return {};
|
|
221
|
+
},
|
|
222
|
+
computed: {
|
|
223
|
+
width() {
|
|
224
|
+
return String(this.text).length * 8 + 12;
|
|
225
|
+
},
|
|
226
|
+
classNames() {
|
|
227
|
+
const { inverted, type, size, absolute } = this;
|
|
228
|
+
return [
|
|
229
|
+
inverted ? 'uni-badge--' + type + '-inverted' : '',
|
|
230
|
+
'uni-badge--' + type,
|
|
231
|
+
'uni-badge--' + size,
|
|
232
|
+
absolute ? 'uni-badge--absolute' : ''
|
|
233
|
+
].join(' ');
|
|
234
|
+
},
|
|
235
|
+
positionStyle() {
|
|
236
|
+
if (!this.absolute) return {};
|
|
237
|
+
let w = this.width / 2,
|
|
238
|
+
h = 10;
|
|
239
|
+
if (this.isDot) {
|
|
240
|
+
w = 5;
|
|
241
|
+
h = 5;
|
|
242
|
+
}
|
|
243
|
+
const x = `${-w + this.offset[0]}px`;
|
|
244
|
+
const y = `${-h + this.offset[1]}px`;
|
|
245
|
+
const whiteList = {
|
|
246
|
+
rightTop: {
|
|
247
|
+
right: x,
|
|
248
|
+
top: y
|
|
249
|
+
},
|
|
250
|
+
rightBottom: {
|
|
251
|
+
right: x,
|
|
252
|
+
bottom: y
|
|
253
|
+
},
|
|
254
|
+
leftBottom: {
|
|
255
|
+
left: x,
|
|
256
|
+
bottom: y
|
|
257
|
+
},
|
|
258
|
+
leftTop: {
|
|
259
|
+
left: x,
|
|
260
|
+
top: y
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
const match = whiteList[this.absolute];
|
|
264
|
+
return match ? match : whiteList['rightTop'];
|
|
265
|
+
},
|
|
266
|
+
dotStyle() {
|
|
267
|
+
if (!this.isDot) return {};
|
|
268
|
+
return {
|
|
269
|
+
width: '10px',
|
|
270
|
+
minWidth: '0',
|
|
271
|
+
height: '10px',
|
|
272
|
+
padding: '0',
|
|
273
|
+
borderRadius: '10px'
|
|
274
|
+
};
|
|
275
|
+
},
|
|
276
|
+
displayValue() {
|
|
277
|
+
const { isDot, text, maxNum } = this;
|
|
278
|
+
return isDot ? '' : Number(text) > maxNum ? `${maxNum}+` : text;
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
methods: {
|
|
282
|
+
onClick() {
|
|
283
|
+
this.$emit('click');
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
</script>
|
|
288
|
+
<style>
|
|
289
|
+
@import 'style.css';
|
|
290
|
+
</style>
|
|
@@ -1 +1,37 @@
|
|
|
1
|
-
<template>
|
|
2
1
|
<view class="uni-breadcrumb">
|
|
3
2
|
<slot />
|
|
4
3
|
</view>
|
|
5
4
|
* Breadcrumb 面包屑导航父组件
|
|
6
5
|
* @description 显示当前页面的路径,快速返回之前的任意页面
|
|
7
6
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=xxx
|
|
8
7
|
* @property {String} separator 分隔符,默认为斜杠'/'
|
|
9
8
|
* @property {String} separatorClass 图标分隔符 class
|
|
10
9
|
*/
|
|
11
10
|
options: {
|
|
12
11
|
virtualHost: true
|
|
13
12
|
},
|
|
14
13
|
props: {
|
|
15
14
|
separator: {
|
|
16
15
|
type: String,
|
|
17
16
|
default: '/'
|
|
18
17
|
},
|
|
19
18
|
separatorClass: {
|
|
20
19
|
type: String,
|
|
21
20
|
default: ''
|
|
22
21
|
}
|
|
23
22
|
},
|
|
24
23
|
provide() {
|
|
25
24
|
return {
|
|
26
25
|
uniBreadcrumb: this
|
|
27
26
|
};
|
|
28
27
|
}
|
|
28
|
+
<template>
|
|
29
|
+
<view class="uni-breadcrumb">
|
|
30
|
+
<slot />
|
|
31
|
+
</view>
|
|
32
|
+
</template>
|
|
33
|
+
<script>
|
|
34
|
+
/**
|
|
35
|
+
* Breadcrumb 面包屑导航父组件
|
|
36
|
+
* @description 显示当前页面的路径,快速返回之前的任意页面
|
|
37
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=xxx
|
|
38
|
+
* @property {String} separator 分隔符,默认为斜杠'/'
|
|
39
|
+
* @property {String} separatorClass 图标分隔符 class
|
|
40
|
+
*/
|
|
41
|
+
export default {
|
|
42
|
+
options: {
|
|
43
|
+
virtualHost: true
|
|
44
|
+
},
|
|
45
|
+
props: {
|
|
46
|
+
separator: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: '/'
|
|
49
|
+
},
|
|
50
|
+
separatorClass: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: ''
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
provide() {
|
|
56
|
+
return {
|
|
57
|
+
uniBreadcrumb: this
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
</script>
|
|
62
|
+
<style>
|
|
63
|
+
@import 'style.css';
|
|
64
|
+
</style>
|
|
@@ -1 +1,83 @@
|
|
|
1
|
-
<template>
|
|
2
1
|
<view class="uni-breadcrumb-item">
|
|
3
2
|
<view
|
|
4
3
|
:class="{
|
|
5
4
|
'uni-breadcrumb-item--slot': true,
|
|
6
5
|
'uni-breadcrumb-item--slot-link': to && currentPage !== to
|
|
7
6
|
}"
|
|
8
7
|
@click="navTo"
|
|
9
8
|
>
|
|
10
9
|
<slot />
|
|
11
10
|
</view>
|
|
12
11
|
<i v-if="separatorClass" class="uni-breadcrumb-item--separator" :class="separatorClass" />
|
|
13
12
|
<text v-else class="uni-breadcrumb-item--separator">{{ separator }}</text>
|
|
14
13
|
</view>
|
|
15
14
|
* BreadcrumbItem 面包屑导航子组件
|
|
16
15
|
* @property {String/Object} to 路由跳转页面路径/对象
|
|
17
16
|
* @property {Boolean} replace 在使用 to 进行路由跳转时,启用 replace 将不会向 history 添加新记录(仅 h5 支持)
|
|
18
17
|
*/
|
|
19
18
|
data() {
|
|
20
19
|
return {
|
|
21
20
|
currentPage: ''
|
|
22
21
|
};
|
|
23
22
|
},
|
|
24
23
|
options: {
|
|
25
24
|
virtualHost: true
|
|
26
25
|
},
|
|
27
26
|
props: {
|
|
28
27
|
to: {
|
|
29
28
|
type: String,
|
|
30
29
|
default: ''
|
|
31
30
|
},
|
|
32
31
|
replace: {
|
|
33
32
|
type: Boolean,
|
|
34
33
|
default: false
|
|
35
34
|
}
|
|
36
35
|
},
|
|
37
36
|
inject: {
|
|
38
37
|
uniBreadcrumb: {
|
|
39
38
|
from: 'uniBreadcrumb',
|
|
40
39
|
default: null
|
|
41
40
|
}
|
|
42
41
|
},
|
|
43
42
|
created() {
|
|
44
43
|
const pages = getCurrentPages();
|
|
45
44
|
const page = pages[pages.length - 1];
|
|
46
45
|
if (page) {
|
|
47
46
|
this.currentPage = `/${page.route}`;
|
|
48
47
|
}
|
|
49
48
|
},
|
|
50
49
|
computed: {
|
|
51
50
|
separator() {
|
|
52
51
|
return this.uniBreadcrumb.separator;
|
|
53
52
|
},
|
|
54
53
|
separatorClass() {
|
|
55
54
|
return this.uniBreadcrumb.separatorClass;
|
|
56
55
|
}
|
|
57
56
|
},
|
|
58
57
|
methods: {
|
|
59
58
|
navTo() {
|
|
60
59
|
const { to } = this;
|
|
61
60
|
if (!to || this.currentPage === to) {
|
|
62
61
|
return;
|
|
63
62
|
}
|
|
64
63
|
if (this.replace) {
|
|
65
64
|
uni.redirectTo({
|
|
66
65
|
url: to
|
|
67
66
|
});
|
|
68
67
|
} else {
|
|
69
68
|
uni.navigateTo({
|
|
70
69
|
url: to
|
|
71
70
|
});
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
73
|
}
|
|
74
|
+
<template>
|
|
75
|
+
<view class="uni-breadcrumb-item">
|
|
76
|
+
<view
|
|
77
|
+
:class="{
|
|
78
|
+
'uni-breadcrumb-item--slot': true,
|
|
79
|
+
'uni-breadcrumb-item--slot-link': to && currentPage !== to
|
|
80
|
+
}"
|
|
81
|
+
@click="navTo"
|
|
82
|
+
>
|
|
83
|
+
<slot />
|
|
84
|
+
</view>
|
|
85
|
+
<i v-if="separatorClass" class="uni-breadcrumb-item--separator" :class="separatorClass" />
|
|
86
|
+
<text v-else class="uni-breadcrumb-item--separator">{{ separator }}</text>
|
|
87
|
+
</view>
|
|
88
|
+
</template>
|
|
89
|
+
<script>
|
|
90
|
+
/**
|
|
91
|
+
* BreadcrumbItem 面包屑导航子组件
|
|
92
|
+
* @property {String/Object} to 路由跳转页面路径/对象
|
|
93
|
+
* @property {Boolean} replace 在使用 to 进行路由跳转时,启用 replace 将不会向 history 添加新记录(仅 h5 支持)
|
|
94
|
+
*/
|
|
95
|
+
export default {
|
|
96
|
+
data() {
|
|
97
|
+
return {
|
|
98
|
+
currentPage: ''
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
options: {
|
|
102
|
+
virtualHost: true
|
|
103
|
+
},
|
|
104
|
+
props: {
|
|
105
|
+
to: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: ''
|
|
108
|
+
},
|
|
109
|
+
replace: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
default: false
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
inject: {
|
|
115
|
+
uniBreadcrumb: {
|
|
116
|
+
from: 'uniBreadcrumb',
|
|
117
|
+
default: null
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
created() {
|
|
121
|
+
const pages = getCurrentPages();
|
|
122
|
+
const page = pages[pages.length - 1];
|
|
123
|
+
if (page) {
|
|
124
|
+
this.currentPage = `/${page.route}`;
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
computed: {
|
|
128
|
+
separator() {
|
|
129
|
+
return this.uniBreadcrumb.separator;
|
|
130
|
+
},
|
|
131
|
+
separatorClass() {
|
|
132
|
+
return this.uniBreadcrumb.separatorClass;
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
methods: {
|
|
136
|
+
navTo() {
|
|
137
|
+
const { to } = this;
|
|
138
|
+
if (!to || this.currentPage === to) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (this.replace) {
|
|
142
|
+
uni.redirectTo({
|
|
143
|
+
url: to
|
|
144
|
+
});
|
|
145
|
+
} else {
|
|
146
|
+
uni.navigateTo({
|
|
147
|
+
url: to
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
</script>
|
|
154
|
+
<style>
|
|
155
|
+
@import 'style.css';
|
|
156
|
+
</style>
|