@kengic/uni 0.3.2-beta.10

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.
Files changed (166) hide show
  1. package/README.md +1 -0
  2. package/dist/index.css +1 -0
  3. package/dist/kengic-uni.js +5 -0
  4. package/dist/src/consts/i18n/en.d.ts +45 -0
  5. package/dist/src/consts/i18n/index.d.ts +90 -0
  6. package/dist/src/consts/i18n/zh_CN.d.ts +45 -0
  7. package/dist/src/consts/index.d.ts +1 -0
  8. package/dist/src/index.d.ts +2 -0
  9. package/dist/src/utils/index.d.ts +1 -0
  10. package/dist/src/utils/kg.util.d.ts +5 -0
  11. package/dist/uni-ui/index.ts +11 -0
  12. package/dist/uni-ui/uni-badge/uni-badge.vue +253 -0
  13. package/dist/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +41 -0
  14. package/dist/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +121 -0
  15. package/dist/uni-ui/uni-calendar/calendar.js +546 -0
  16. package/dist/uni-ui/uni-calendar/i18n/en.json +12 -0
  17. package/dist/uni-ui/uni-calendar/i18n/index.js +8 -0
  18. package/dist/uni-ui/uni-calendar/i18n/zh-Hans.json +12 -0
  19. package/dist/uni-ui/uni-calendar/i18n/zh-Hant.json +12 -0
  20. package/dist/uni-ui/uni-calendar/uni-calendar-item.vue +187 -0
  21. package/dist/uni-ui/uni-calendar/uni-calendar.vue +566 -0
  22. package/dist/uni-ui/uni-calendar/util.js +360 -0
  23. package/dist/uni-ui/uni-card/uni-card.vue +281 -0
  24. package/dist/uni-ui/uni-col/uni-col.vue +317 -0
  25. package/dist/uni-ui/uni-collapse/uni-collapse.vue +147 -0
  26. package/dist/uni-ui/uni-collapse-item/uni-collapse-item.vue +402 -0
  27. package/dist/uni-ui/uni-combox/uni-combox.vue +294 -0
  28. package/dist/uni-ui/uni-countdown/i18n/en.json +6 -0
  29. package/dist/uni-ui/uni-countdown/i18n/index.js +8 -0
  30. package/dist/uni-ui/uni-countdown/i18n/zh-Hans.json +6 -0
  31. package/dist/uni-ui/uni-countdown/i18n/zh-Hant.json +6 -0
  32. package/dist/uni-ui/uni-countdown/uni-countdown.vue +267 -0
  33. package/dist/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +821 -0
  34. package/dist/uni-ui/uni-data-picker/keypress.js +45 -0
  35. package/dist/uni-ui/uni-data-picker/uni-data-picker.vue +551 -0
  36. package/dist/uni-ui/uni-data-pickerview/uni-data-picker.js +622 -0
  37. package/dist/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +323 -0
  38. package/dist/uni-ui/uni-data-select/uni-data-select.vue +517 -0
  39. package/dist/uni-ui/uni-dateformat/date-format.js +200 -0
  40. package/dist/uni-ui/uni-dateformat/uni-dateformat.vue +88 -0
  41. package/dist/uni-ui/uni-datetime-picker/calendar-item.vue +177 -0
  42. package/dist/uni-ui/uni-datetime-picker/calendar.vue +928 -0
  43. package/dist/uni-ui/uni-datetime-picker/i18n/en.json +22 -0
  44. package/dist/uni-ui/uni-datetime-picker/i18n/index.js +8 -0
  45. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +22 -0
  46. package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +22 -0
  47. package/dist/uni-ui/uni-datetime-picker/time-picker.vue +934 -0
  48. package/dist/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1026 -0
  49. package/dist/uni-ui/uni-datetime-picker/util.js +403 -0
  50. package/dist/uni-ui/uni-drawer/keypress.js +45 -0
  51. package/dist/uni-ui/uni-drawer/uni-drawer.vue +181 -0
  52. package/dist/uni-ui/uni-easyinput/common.js +56 -0
  53. package/dist/uni-ui/uni-easyinput/uni-easyinput.vue +660 -0
  54. package/dist/uni-ui/uni-fab/uni-fab.vue +491 -0
  55. package/dist/uni-ui/uni-fav/i18n/en.json +4 -0
  56. package/dist/uni-ui/uni-fav/i18n/index.js +8 -0
  57. package/dist/uni-ui/uni-fav/i18n/zh-Hans.json +4 -0
  58. package/dist/uni-ui/uni-fav/i18n/zh-Hant.json +4 -0
  59. package/dist/uni-ui/uni-fav/uni-fav.vue +161 -0
  60. package/dist/uni-ui/uni-file-picker/choose-and-upload-file.js +224 -0
  61. package/dist/uni-ui/uni-file-picker/uni-file-picker.vue +667 -0
  62. package/dist/uni-ui/uni-file-picker/upload-file.vue +325 -0
  63. package/dist/uni-ui/uni-file-picker/upload-image.vue +292 -0
  64. package/dist/uni-ui/uni-file-picker/utils.js +109 -0
  65. package/dist/uni-ui/uni-forms/uni-forms.vue +398 -0
  66. package/dist/uni-ui/uni-forms/utils.js +293 -0
  67. package/dist/uni-ui/uni-forms/validate.js +486 -0
  68. package/dist/uni-ui/uni-forms-item/uni-forms-item.vue +601 -0
  69. package/dist/uni-ui/uni-goods-nav/i18n/en.json +6 -0
  70. package/dist/uni-ui/uni-goods-nav/i18n/index.js +8 -0
  71. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hans.json +6 -0
  72. package/dist/uni-ui/uni-goods-nav/i18n/zh-Hant.json +6 -0
  73. package/dist/uni-ui/uni-goods-nav/uni-goods-nav.vue +229 -0
  74. package/dist/uni-ui/uni-grid/uni-grid.vue +143 -0
  75. package/dist/uni-ui/uni-grid-item/uni-grid-item.vue +129 -0
  76. package/dist/uni-ui/uni-group/uni-group.vue +134 -0
  77. package/dist/uni-ui/uni-icons/icons.js +1169 -0
  78. package/dist/uni-ui/uni-icons/uni-icons.vue +96 -0
  79. package/dist/uni-ui/uni-icons/uniicons.css +663 -0
  80. package/dist/uni-ui/uni-icons/uniicons.ttf +0 -0
  81. package/dist/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +144 -0
  82. package/dist/uni-ui/uni-indexed-list/uni-indexed-list.vue +367 -0
  83. package/dist/uni-ui/uni-link/uni-link.vue +128 -0
  84. package/dist/uni-ui/uni-list/uni-list.vue +123 -0
  85. package/dist/uni-ui/uni-list/uni-refresh.vue +65 -0
  86. package/dist/uni-ui/uni-list/uni-refresh.wxs +87 -0
  87. package/dist/uni-ui/uni-list-ad/uni-list-ad.vue +107 -0
  88. package/dist/uni-ui/uni-list-chat/uni-list-chat.scss +58 -0
  89. package/dist/uni-ui/uni-list-chat/uni-list-chat.vue +593 -0
  90. package/dist/uni-ui/uni-list-item/uni-list-item.vue +534 -0
  91. package/dist/uni-ui/uni-load-more/i18n/en.json +5 -0
  92. package/dist/uni-ui/uni-load-more/i18n/index.js +8 -0
  93. package/dist/uni-ui/uni-load-more/i18n/zh-Hans.json +5 -0
  94. package/dist/uni-ui/uni-load-more/i18n/zh-Hant.json +5 -0
  95. package/dist/uni-ui/uni-load-more/uni-load-more.vue +399 -0
  96. package/dist/uni-ui/uni-nav-bar/uni-nav-bar.vue +357 -0
  97. package/dist/uni-ui/uni-nav-bar/uni-status-bar.vue +24 -0
  98. package/dist/uni-ui/uni-notice-bar/uni-notice-bar.vue +426 -0
  99. package/dist/uni-ui/uni-number-box/uni-number-box.vue +221 -0
  100. package/dist/uni-ui/uni-pagination/i18n/en.json +5 -0
  101. package/dist/uni-ui/uni-pagination/i18n/es.json +5 -0
  102. package/dist/uni-ui/uni-pagination/i18n/fr.json +5 -0
  103. package/dist/uni-ui/uni-pagination/i18n/index.js +12 -0
  104. package/dist/uni-ui/uni-pagination/i18n/zh-Hans.json +5 -0
  105. package/dist/uni-ui/uni-pagination/i18n/zh-Hant.json +5 -0
  106. package/dist/uni-ui/uni-pagination/uni-pagination.vue +465 -0
  107. package/dist/uni-ui/uni-popup/i18n/en.json +7 -0
  108. package/dist/uni-ui/uni-popup/i18n/index.js +9 -0
  109. package/dist/uni-ui/uni-popup/i18n/zh-Hans.json +7 -0
  110. package/dist/uni-ui/uni-popup/i18n/zh-Hant.json +7 -0
  111. package/dist/uni-ui/uni-popup/keypress.js +45 -0
  112. package/dist/uni-ui/uni-popup/popup.js +23 -0
  113. package/dist/uni-ui/uni-popup/uni-popup.vue +464 -0
  114. package/dist/uni-ui/uni-popup-dialog/keypress.js +45 -0
  115. package/dist/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +275 -0
  116. package/dist/uni-ui/uni-popup-message/uni-popup-message.vue +143 -0
  117. package/dist/uni-ui/uni-popup-share/uni-popup-share.vue +187 -0
  118. package/dist/uni-ui/uni-rate/uni-rate.vue +365 -0
  119. package/dist/uni-ui/uni-row/uni-row.vue +190 -0
  120. package/dist/uni-ui/uni-scss/changelog.md +8 -0
  121. package/dist/uni-ui/uni-scss/index.scss +1 -0
  122. package/dist/uni-ui/uni-scss/package.json +82 -0
  123. package/dist/uni-ui/uni-scss/readme.md +4 -0
  124. package/dist/uni-ui/uni-scss/styles/index.scss +7 -0
  125. package/dist/uni-ui/uni-scss/styles/setting/_border.scss +3 -0
  126. package/dist/uni-ui/uni-scss/styles/setting/_color.scss +66 -0
  127. package/dist/uni-ui/uni-scss/styles/setting/_radius.scss +55 -0
  128. package/dist/uni-ui/uni-scss/styles/setting/_space.scss +56 -0
  129. package/dist/uni-ui/uni-scss/styles/setting/_styles.scss +167 -0
  130. package/dist/uni-ui/uni-scss/styles/setting/_text.scss +24 -0
  131. package/dist/uni-ui/uni-scss/styles/setting/_variables.scss +146 -0
  132. package/dist/uni-ui/uni-scss/styles/tools/functions.scss +19 -0
  133. package/dist/uni-ui/uni-scss/theme.scss +31 -0
  134. package/dist/uni-ui/uni-scss/variables.scss +62 -0
  135. package/dist/uni-ui/uni-search-bar/i18n/en.json +4 -0
  136. package/dist/uni-ui/uni-search-bar/i18n/index.js +8 -0
  137. package/dist/uni-ui/uni-search-bar/i18n/zh-Hans.json +4 -0
  138. package/dist/uni-ui/uni-search-bar/i18n/zh-Hant.json +4 -0
  139. package/dist/uni-ui/uni-search-bar/uni-search-bar.vue +298 -0
  140. package/dist/uni-ui/uni-section/uni-section.vue +167 -0
  141. package/dist/uni-ui/uni-segmented-control/uni-segmented-control.vue +145 -0
  142. package/dist/uni-ui/uni-steps/uni-steps.vue +269 -0
  143. package/dist/uni-ui/uni-swipe-action/uni-swipe-action.vue +60 -0
  144. package/dist/uni-ui/uni-swipe-action-item/bindingx.js +302 -0
  145. package/dist/uni-ui/uni-swipe-action-item/isPC.js +12 -0
  146. package/dist/uni-ui/uni-swipe-action-item/mpalipay.js +195 -0
  147. package/dist/uni-ui/uni-swipe-action-item/mpother.js +260 -0
  148. package/dist/uni-ui/uni-swipe-action-item/mpwxs.js +84 -0
  149. package/dist/uni-ui/uni-swipe-action-item/render.js +270 -0
  150. package/dist/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +347 -0
  151. package/dist/uni-ui/uni-swipe-action-item/wx.wxs +341 -0
  152. package/dist/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +218 -0
  153. package/dist/uni-ui/uni-table/uni-table.vue +455 -0
  154. package/dist/uni-ui/uni-tag/uni-tag.vue +252 -0
  155. package/dist/uni-ui/uni-tbody/uni-tbody.vue +29 -0
  156. package/dist/uni-ui/uni-td/uni-td.vue +90 -0
  157. package/dist/uni-ui/uni-th/filter-dropdown.vue +511 -0
  158. package/dist/uni-ui/uni-th/uni-th.vue +285 -0
  159. package/dist/uni-ui/uni-thead/uni-thead.vue +129 -0
  160. package/dist/uni-ui/uni-title/uni-title.vue +171 -0
  161. package/dist/uni-ui/uni-tooltip/uni-tooltip.vue +68 -0
  162. package/dist/uni-ui/uni-tr/table-checkbox.vue +179 -0
  163. package/dist/uni-ui/uni-tr/uni-tr.vue +171 -0
  164. package/dist/uni-ui/uni-transition/createAnimation.js +131 -0
  165. package/dist/uni-ui/uni-transition/uni-transition.vue +281 -0
  166. package/package.json +90 -0
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @kengic/uni
package/dist/index.css ADDED
@@ -0,0 +1 @@
1
+ uni-button{border-radius:3px!important}
@@ -0,0 +1,5 @@
1
+ class t {
2
+ }
3
+ export {
4
+ t as KgUtil
5
+ };
@@ -0,0 +1,45 @@
1
+ declare const _default: {
2
+ kg: {
3
+ KgSearch: {
4
+ title: string;
5
+ };
6
+ KgTable: {
7
+ column: string;
8
+ emptyText: string;
9
+ totalText: string;
10
+ };
11
+ KgTableInfo: {
12
+ check: string;
13
+ clearCheck: string;
14
+ clearTable: string;
15
+ locate: string;
16
+ row: string;
17
+ };
18
+ action: string;
19
+ add: string;
20
+ button: string;
21
+ cancel: string;
22
+ confirm: string;
23
+ confirmDelete: string;
24
+ copy: string;
25
+ create: string;
26
+ delete: string;
27
+ deleteSuccess: string;
28
+ edit: string;
29
+ emptyText: string;
30
+ export: string;
31
+ import: string;
32
+ lookup: string;
33
+ no: string;
34
+ query: string;
35
+ required: string;
36
+ reset: string;
37
+ save: string;
38
+ search: string;
39
+ show: string;
40
+ tip: string;
41
+ update: string;
42
+ yes: string;
43
+ };
44
+ };
45
+ export default _default;
@@ -0,0 +1,90 @@
1
+ export declare const KG_I18N: {
2
+ en: {
3
+ kg: {
4
+ KgSearch: {
5
+ title: string;
6
+ };
7
+ KgTable: {
8
+ column: string;
9
+ emptyText: string;
10
+ totalText: string;
11
+ };
12
+ KgTableInfo: {
13
+ check: string;
14
+ clearCheck: string;
15
+ clearTable: string;
16
+ locate: string;
17
+ row: string;
18
+ };
19
+ action: string;
20
+ add: string;
21
+ button: string;
22
+ cancel: string;
23
+ confirm: string;
24
+ confirmDelete: string;
25
+ copy: string;
26
+ create: string;
27
+ delete: string;
28
+ deleteSuccess: string;
29
+ edit: string;
30
+ emptyText: string;
31
+ export: string;
32
+ import: string;
33
+ lookup: string;
34
+ no: string;
35
+ query: string;
36
+ required: string;
37
+ reset: string;
38
+ save: string;
39
+ search: string;
40
+ show: string;
41
+ tip: string;
42
+ update: string;
43
+ yes: string;
44
+ };
45
+ };
46
+ zh_CN: {
47
+ kg: {
48
+ KgSearch: {
49
+ title: string;
50
+ };
51
+ KgTable: {
52
+ column: string;
53
+ emptyText: string;
54
+ totalText: string;
55
+ };
56
+ KgTableInfo: {
57
+ check: string;
58
+ clearCheck: string;
59
+ clearTable: string;
60
+ locate: string;
61
+ row: string;
62
+ };
63
+ action: string;
64
+ add: string;
65
+ button: string;
66
+ cancel: string;
67
+ confirm: string;
68
+ confirmDelete: string;
69
+ copy: string;
70
+ create: string;
71
+ delete: string;
72
+ deleteSuccess: string;
73
+ edit: string;
74
+ emptyText: string;
75
+ export: string;
76
+ import: string;
77
+ lookup: string;
78
+ no: string;
79
+ query: string;
80
+ required: string;
81
+ reset: string;
82
+ save: string;
83
+ search: string;
84
+ show: string;
85
+ tip: string;
86
+ update: string;
87
+ yes: string;
88
+ };
89
+ };
90
+ };
@@ -0,0 +1,45 @@
1
+ declare const _default: {
2
+ kg: {
3
+ KgSearch: {
4
+ title: string;
5
+ };
6
+ KgTable: {
7
+ column: string;
8
+ emptyText: string;
9
+ totalText: string;
10
+ };
11
+ KgTableInfo: {
12
+ check: string;
13
+ clearCheck: string;
14
+ clearTable: string;
15
+ locate: string;
16
+ row: string;
17
+ };
18
+ action: string;
19
+ add: string;
20
+ button: string;
21
+ cancel: string;
22
+ confirm: string;
23
+ confirmDelete: string;
24
+ copy: string;
25
+ create: string;
26
+ delete: string;
27
+ deleteSuccess: string;
28
+ edit: string;
29
+ emptyText: string;
30
+ export: string;
31
+ import: string;
32
+ lookup: string;
33
+ no: string;
34
+ query: string;
35
+ required: string;
36
+ reset: string;
37
+ save: string;
38
+ search: string;
39
+ show: string;
40
+ tip: string;
41
+ update: string;
42
+ yes: string;
43
+ };
44
+ };
45
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import './assets/index.less';
2
+ export * from './utils';
@@ -0,0 +1 @@
1
+ export * from './kg.util';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 通用工具.
3
+ */
4
+ export declare class KgUtil {
5
+ }
@@ -0,0 +1,11 @@
1
+ export { default as UniBadge } from './uni-badge/uni-badge.vue';
2
+ export { default as UniCard } from './uni-card/uni-card.vue';
3
+ export { default as UniEasyinput } from './uni-easyinput/uni-easyinput.vue';
4
+ export { default as UniForms } from './uni-forms/uni-forms.vue';
5
+ export { default as UniFormsItem } from './uni-forms-item/uni-forms-item.vue';
6
+ export { default as UniGrid } from './uni-grid/uni-grid.vue';
7
+ export { default as UniGridItem } from './uni-grid-item/uni-grid-item.vue';
8
+ export { default as UniList } from './uni-list/uni-list.vue';
9
+ export { default as UniListItem } from './uni-list-item/uni-list-item.vue';
10
+ export { default as UniPopup } from './uni-popup/uni-popup.vue';
11
+ export { default as UniIcons } from './uni-icons/uni-icons.vue';
@@ -0,0 +1,253 @@
1
+ <template>
2
+ <view class="uni-badge--x">
3
+ <slot />
4
+ <text v-if="text" :class="classNames" :style="[positionStyle, customStyle, dotStyle]" class="uni-badge" @click="onClick()">{{ displayValue }} </text>
5
+ </view>
6
+ </template>
7
+
8
+ <script>
9
+ /**
10
+ * Badge 数字角标
11
+ * @description 数字角标一般和其它控件(列表、9宫格等)配合使用,用于进行数量提示,默认为实心灰色背景
12
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=21
13
+ * @property {String} text 角标内容
14
+ * @property {String} size = [normal|small] 角标内容
15
+ * @property {String} type = [info|primary|success|warning|error] 颜色类型
16
+ * @value info 灰色
17
+ * @value primary 蓝色
18
+ * @value success 绿色
19
+ * @value warning 黄色
20
+ * @value error 红色
21
+ * @property {String} inverted = [true|false] 是否无需背景颜色
22
+ * @property {Number} maxNum 展示封顶的数字值,超过 99 显示 99+
23
+ * @property {String} absolute = [rightTop|rightBottom|leftBottom|leftTop] 开启绝对定位, 角标将定位到其包裹的标签的四角上
24
+ * @value rightTop 右上
25
+ * @value rightBottom 右下
26
+ * @value leftTop 左上
27
+ * @value leftBottom 左下
28
+ * @property {Array[number]} offset 距定位角中心点的偏移量,只有存在 absolute 属性时有效,例如:[-10, -10] 表示向外偏移 10px,[10, 10] 表示向 absolute 指定的内偏移 10px
29
+ * @property {String} isDot = [true|false] 是否显示为一个小点
30
+ * @event {Function} click 点击 Badge 触发事件
31
+ * @example <uni-badge text="1"></uni-badge>
32
+ */
33
+
34
+ export default {
35
+ name: 'UniBadge',
36
+ emits: ['click'],
37
+ props: {
38
+ type: {
39
+ type: String,
40
+ default: 'error',
41
+ },
42
+ inverted: {
43
+ type: Boolean,
44
+ default: false,
45
+ },
46
+ isDot: {
47
+ type: Boolean,
48
+ default: false,
49
+ },
50
+ maxNum: {
51
+ type: Number,
52
+ default: 99,
53
+ },
54
+ absolute: {
55
+ type: String,
56
+ default: '',
57
+ },
58
+ offset: {
59
+ type: Array,
60
+ default() {
61
+ return [0, 0];
62
+ },
63
+ },
64
+ text: {
65
+ type: [String, Number],
66
+ default: '',
67
+ },
68
+ size: {
69
+ type: String,
70
+ default: 'small',
71
+ },
72
+ customStyle: {
73
+ type: Object,
74
+ default() {
75
+ return {};
76
+ },
77
+ },
78
+ },
79
+ data() {
80
+ return {};
81
+ },
82
+ computed: {
83
+ width() {
84
+ return String(this.text).length * 8 + 12;
85
+ },
86
+ classNames() {
87
+ const { inverted, type, size, absolute } = this;
88
+ return [inverted ? 'uni-badge--' + type + '-inverted' : '', 'uni-badge--' + type, 'uni-badge--' + size, absolute ? 'uni-badge--absolute' : ''].join(
89
+ ' ',
90
+ );
91
+ },
92
+ positionStyle() {
93
+ if (!this.absolute) return {};
94
+ let w = this.width / 2,
95
+ h = 10;
96
+ if (this.isDot) {
97
+ w = 5;
98
+ h = 5;
99
+ }
100
+ const x = `${-w + this.offset[0]}px`;
101
+ const y = `${-h + this.offset[1]}px`;
102
+
103
+ const whiteList = {
104
+ rightTop: {
105
+ right: x,
106
+ top: y,
107
+ },
108
+ rightBottom: {
109
+ right: x,
110
+ bottom: y,
111
+ },
112
+ leftBottom: {
113
+ left: x,
114
+ bottom: y,
115
+ },
116
+ leftTop: {
117
+ left: x,
118
+ top: y,
119
+ },
120
+ };
121
+ const match = whiteList[this.absolute];
122
+ return match ? match : whiteList['rightTop'];
123
+ },
124
+ dotStyle() {
125
+ if (!this.isDot) return {};
126
+ return {
127
+ width: '10px',
128
+ minWidth: '0',
129
+ height: '10px',
130
+ padding: '0',
131
+ borderRadius: '10px',
132
+ };
133
+ },
134
+ displayValue() {
135
+ const { isDot, text, maxNum } = this;
136
+ return isDot ? '' : Number(text) > maxNum ? `${maxNum}+` : text;
137
+ },
138
+ },
139
+ methods: {
140
+ onClick() {
141
+ this.$emit('click');
142
+ },
143
+ },
144
+ };
145
+ </script>
146
+
147
+ <style lang="scss">
148
+ $uni-primary: #2979ff !default;
149
+ $uni-success: #4cd964 !default;
150
+ $uni-warning: #f0ad4e !default;
151
+ $uni-error: #dd524d !default;
152
+ $uni-info: #909399 !default;
153
+
154
+ $bage-size: 12px;
155
+ $bage-small: scale(0.8);
156
+
157
+ .uni-badge--x {
158
+ /* #ifdef APP-NVUE */
159
+ // align-self: flex-start;
160
+ /* #endif */
161
+ /* #ifndef APP-NVUE */
162
+ display: inline-block;
163
+ /* #endif */
164
+ position: relative;
165
+ }
166
+
167
+ .uni-badge--absolute {
168
+ position: absolute;
169
+ }
170
+
171
+ .uni-badge--small {
172
+ transform: $bage-small;
173
+ transform-origin: center center;
174
+ }
175
+
176
+ .uni-badge {
177
+ /* #ifndef APP-NVUE */
178
+ display: flex;
179
+ overflow: hidden;
180
+ box-sizing: border-box;
181
+ font-feature-settings: 'tnum';
182
+ min-width: 20px;
183
+ /* #endif */
184
+ justify-content: center;
185
+ flex-direction: row;
186
+ height: 20px;
187
+ padding: 0 4px;
188
+ line-height: 18px;
189
+ color: #fff;
190
+ border-radius: 100px;
191
+ background-color: $uni-info;
192
+ background-color: transparent;
193
+ border: 1px solid #fff;
194
+ text-align: center;
195
+ font-family: 'Helvetica Neue', Helvetica, sans-serif;
196
+ font-size: $bage-size;
197
+ /* #ifdef H5 */
198
+ z-index: 999;
199
+ cursor: pointer;
200
+ /* #endif */
201
+
202
+ &--info {
203
+ color: #fff;
204
+ background-color: $uni-info;
205
+ }
206
+
207
+ &--primary {
208
+ background-color: $uni-primary;
209
+ }
210
+
211
+ &--success {
212
+ background-color: $uni-success;
213
+ }
214
+
215
+ &--warning {
216
+ background-color: $uni-warning;
217
+ }
218
+
219
+ &--error {
220
+ background-color: $uni-error;
221
+ }
222
+
223
+ &--inverted {
224
+ padding: 0 5px 0 0;
225
+ color: $uni-info;
226
+ }
227
+
228
+ &--info-inverted {
229
+ color: $uni-info;
230
+ background-color: transparent;
231
+ }
232
+
233
+ &--primary-inverted {
234
+ color: $uni-primary;
235
+ background-color: transparent;
236
+ }
237
+
238
+ &--success-inverted {
239
+ color: $uni-success;
240
+ background-color: transparent;
241
+ }
242
+
243
+ &--warning-inverted {
244
+ color: $uni-warning;
245
+ background-color: transparent;
246
+ }
247
+
248
+ &--error-inverted {
249
+ color: $uni-error;
250
+ background-color: transparent;
251
+ }
252
+ }
253
+ </style>
@@ -0,0 +1,41 @@
1
+ <template>
2
+ <view class="uni-breadcrumb">
3
+ <slot />
4
+ </view>
5
+ </template>
6
+ <script>
7
+ /**
8
+ * Breadcrumb 面包屑导航父组件
9
+ * @description 显示当前页面的路径,快速返回之前的任意页面
10
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=xxx
11
+ * @property {String} separator 分隔符,默认为斜杠'/'
12
+ * @property {String} separatorClass 图标分隔符 class
13
+ */
14
+ export default {
15
+ options: {
16
+ virtualHost: true
17
+ },
18
+ props: {
19
+ separator: {
20
+ type: String,
21
+ default: '/'
22
+ },
23
+ separatorClass: {
24
+ type: String,
25
+ default: ''
26
+ }
27
+ },
28
+
29
+ provide() {
30
+ return {
31
+ uniBreadcrumb: this
32
+ }
33
+ }
34
+
35
+ }
36
+ </script>
37
+ <style lang="scss">
38
+ .uni-breadcrumb {
39
+ display: flex;
40
+ }
41
+ </style>
@@ -0,0 +1,121 @@
1
+ <template>
2
+ <view class="uni-breadcrumb-item">
3
+ <view :class="{
4
+ 'uni-breadcrumb-item--slot': true,
5
+ 'uni-breadcrumb-item--slot-link': to && currentPage !== to
6
+ }" @click="navTo">
7
+ <slot />
8
+ </view>
9
+ <i v-if="separatorClass" class="uni-breadcrumb-item--separator" :class="separatorClass" />
10
+ <text v-else class="uni-breadcrumb-item--separator">{{ separator }}</text>
11
+ </view>
12
+ </template>
13
+ <script>
14
+ /**
15
+ * BreadcrumbItem 面包屑导航子组件
16
+ * @property {String/Object} to 路由跳转页面路径/对象
17
+ * @property {Boolean} replace 在使用 to 进行路由跳转时,启用 replace 将不会向 history 添加新记录(仅 h5 支持)
18
+ */
19
+ export default {
20
+ data() {
21
+ return {
22
+ currentPage: ""
23
+ }
24
+ },
25
+ options: {
26
+ virtualHost: true
27
+ },
28
+ props: {
29
+ to: {
30
+ type: String,
31
+ default: ''
32
+ },
33
+ replace:{
34
+ type: Boolean,
35
+ default: false
36
+ }
37
+ },
38
+ inject: {
39
+ uniBreadcrumb: {
40
+ from: "uniBreadcrumb",
41
+ default: null
42
+ }
43
+ },
44
+ created(){
45
+ const pages = getCurrentPages()
46
+ const page = pages[pages.length-1]
47
+
48
+ if(page){
49
+ this.currentPage = `/${page.route}`
50
+ }
51
+ },
52
+ computed: {
53
+ separator() {
54
+ return this.uniBreadcrumb.separator
55
+ },
56
+ separatorClass() {
57
+ return this.uniBreadcrumb.separatorClass
58
+ }
59
+ },
60
+ methods: {
61
+ navTo() {
62
+ const { to } = this
63
+
64
+ if (!to || this.currentPage === to){
65
+ return
66
+ }
67
+
68
+ if(this.replace){
69
+ uni.redirectTo({
70
+ url:to
71
+ })
72
+ }else{
73
+ uni.navigateTo({
74
+ url:to
75
+ })
76
+ }
77
+ }
78
+ }
79
+ }
80
+ </script>
81
+ <style lang="scss">
82
+ $uni-primary: #2979ff !default;
83
+ $uni-base-color: #6a6a6a !default;
84
+ $uni-main-color: #3a3a3a !default;
85
+ .uni-breadcrumb-item {
86
+ display: flex;
87
+ align-items: center;
88
+ white-space: nowrap;
89
+ font-size: 14px;
90
+
91
+ &--slot {
92
+ color: $uni-base-color;
93
+ padding: 0 10px;
94
+
95
+ &-link {
96
+ color: $uni-main-color;
97
+ font-weight: bold;
98
+ /* #ifndef APP-NVUE */
99
+ cursor: pointer;
100
+ /* #endif */
101
+
102
+ &:hover {
103
+ color: $uni-primary;
104
+ }
105
+ }
106
+ }
107
+
108
+ &--separator {
109
+ font-size: 12px;
110
+ color: $uni-base-color;
111
+ }
112
+
113
+ &:first-child &--slot {
114
+ padding-left: 0;
115
+ }
116
+
117
+ &:last-child &--separator {
118
+ display: none;
119
+ }
120
+ }
121
+ </style>