@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.
Files changed (146) hide show
  1. package/dist/uni/uni-ui/uni-badge/uni-badge.vue +222 -219
  2. package/dist/uni/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +29 -29
  3. package/dist/uni/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +88 -88
  4. package/dist/uni/uni-ui/uni-calendar/calendar.js +936 -532
  5. package/dist/uni/uni-ui/uni-calendar/i18n/en.json +10 -10
  6. package/dist/uni/uni-ui/uni-calendar/i18n/index.js +8 -7
  7. package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hans.json +10 -10
  8. package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hant.json +10 -10
  9. package/dist/uni/uni-ui/uni-calendar/uni-calendar-item.vue +190 -168
  10. package/dist/uni/uni-ui/uni-calendar/uni-calendar.vue +459 -459
  11. package/dist/uni/uni-ui/uni-calendar/util.js +324 -340
  12. package/dist/uni/uni-ui/uni-card/uni-card.vue +8 -1
  13. package/dist/uni/uni-ui/uni-col/uni-col.vue +294 -287
  14. package/dist/uni/uni-ui/uni-collapse/uni-collapse.vue +139 -140
  15. package/dist/uni/uni-ui/uni-collapse-item/uni-collapse-item.vue +381 -378
  16. package/dist/uni/uni-ui/uni-combox/uni-combox.vue +280 -272
  17. package/dist/uni/uni-ui/uni-countdown/i18n/en.json +4 -4
  18. package/dist/uni/uni-ui/uni-countdown/i18n/index.js +8 -7
  19. package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hans.json +4 -4
  20. package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hant.json +4 -4
  21. package/dist/uni/uni-ui/uni-countdown/uni-countdown.vue +249 -257
  22. package/dist/uni/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +832 -813
  23. package/dist/uni/uni-ui/uni-data-picker/keypress.js +42 -42
  24. package/dist/uni/uni-ui/uni-data-picker/uni-data-picker.vue +535 -516
  25. package/dist/uni/uni-ui/uni-data-pickerview/uni-data-picker.js +623 -618
  26. package/dist/uni/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +293 -288
  27. package/dist/uni/uni-ui/uni-data-select/uni-data-select.vue +495 -509
  28. package/dist/uni/uni-ui/uni-dateformat/date-format.js +181 -184
  29. package/dist/uni/uni-ui/uni-dateformat/uni-dateformat.vue +81 -82
  30. package/dist/uni/uni-ui/uni-datetime-picker/calendar-item.vue +176 -170
  31. package/dist/uni/uni-ui/uni-datetime-picker/calendar.vue +926 -920
  32. package/dist/uni/uni-ui/uni-datetime-picker/i18n/en.json +20 -20
  33. package/dist/uni/uni-ui/uni-datetime-picker/i18n/index.js +8 -7
  34. package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +21 -21
  35. package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +21 -21
  36. package/dist/uni/uni-ui/uni-datetime-picker/time-picker.vue +921 -926
  37. package/dist/uni/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1059 -1012
  38. package/dist/uni/uni-ui/uni-datetime-picker/util.js +366 -377
  39. package/dist/uni/uni-ui/uni-drawer/keypress.js +42 -42
  40. package/dist/uni/uni-ui/uni-drawer/uni-drawer.vue +176 -167
  41. package/dist/uni/uni-ui/uni-easyinput/common.js +40 -42
  42. package/dist/uni/uni-ui/uni-easyinput/uni-easyinput.vue +628 -547
  43. package/dist/uni/uni-ui/uni-fab/uni-fab.vue +507 -483
  44. package/dist/uni/uni-ui/uni-fav/i18n/en.json +2 -2
  45. package/dist/uni/uni-ui/uni-fav/i18n/index.js +8 -7
  46. package/dist/uni/uni-ui/uni-fav/i18n/zh-Hans.json +2 -2
  47. package/dist/uni/uni-ui/uni-fav/i18n/zh-Hant.json +2 -2
  48. package/dist/uni/uni-ui/uni-fav/uni-fav.vue +155 -147
  49. package/dist/uni/uni-ui/uni-file-picker/choose-and-upload-file.js +172 -198
  50. package/dist/uni/uni-ui/uni-file-picker/uni-file-picker.vue +636 -634
  51. package/dist/uni/uni-ui/uni-file-picker/upload-file.vue +294 -293
  52. package/dist/uni/uni-ui/uni-file-picker/upload-image.vue +267 -270
  53. package/dist/uni/uni-ui/uni-file-picker/utils.js +81 -82
  54. package/dist/uni/uni-ui/uni-forms/uni-forms.vue +360 -372
  55. package/dist/uni/uni-ui/uni-forms/utils.js +170 -174
  56. package/dist/uni/uni-ui/uni-forms/validate.js +447 -456
  57. package/dist/uni/uni-ui/uni-forms-item/uni-forms-item.vue +497 -497
  58. package/dist/uni/uni-ui/uni-goods-nav/i18n/en.json +4 -4
  59. package/dist/uni/uni-ui/uni-goods-nav/i18n/index.js +8 -7
  60. package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hans.json +4 -4
  61. package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hant.json +4 -4
  62. package/dist/uni/uni-ui/uni-goods-nav/uni-goods-nav.vue +238 -222
  63. package/dist/uni/uni-ui/uni-grid/uni-grid.vue +134 -134
  64. package/dist/uni/uni-ui/uni-grid-item/uni-grid-item.vue +121 -119
  65. package/dist/uni/uni-ui/uni-group/uni-group.vue +121 -121
  66. package/dist/uni/uni-ui/uni-icons/icons.js +1170 -1168
  67. package/dist/uni/uni-ui/uni-icons/uni-icons.vue +91 -86
  68. package/dist/uni/uni-ui/uni-icons/uniicons.css +166 -166
  69. package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +129 -129
  70. package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list.vue +352 -347
  71. package/dist/uni/uni-ui/uni-link/uni-link.vue +134 -119
  72. package/dist/uni/uni-ui/uni-list/uni-list.vue +119 -110
  73. package/dist/uni/uni-ui/uni-list/uni-refresh.vue +14 -14
  74. package/dist/uni/uni-ui/uni-list/uni-refresh.wxs +14 -14
  75. package/dist/uni/uni-ui/uni-list-ad/uni-list-ad.vue +101 -95
  76. package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.scss +18 -18
  77. package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.vue +602 -586
  78. package/dist/uni/uni-ui/uni-list-item/uni-list-item.vue +507 -503
  79. package/dist/uni/uni-ui/uni-load-more/i18n/en.json +3 -3
  80. package/dist/uni/uni-ui/uni-load-more/i18n/index.js +8 -7
  81. package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hans.json +3 -3
  82. package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hant.json +3 -3
  83. package/dist/uni/uni-ui/uni-load-more/uni-load-more.vue +402 -392
  84. package/dist/uni/uni-ui/uni-nav-bar/uni-nav-bar.vue +328 -330
  85. package/dist/uni/uni-ui/uni-nav-bar/uni-status-bar.vue +17 -17
  86. package/dist/uni/uni-ui/uni-notice-bar/uni-notice-bar.vue +422 -401
  87. package/dist/uni/uni-ui/uni-number-box/uni-number-box.vue +211 -205
  88. package/dist/uni/uni-ui/uni-pagination/i18n/en.json +3 -3
  89. package/dist/uni/uni-ui/uni-pagination/i18n/es.json +3 -3
  90. package/dist/uni/uni-ui/uni-pagination/i18n/fr.json +3 -3
  91. package/dist/uni/uni-ui/uni-pagination/i18n/index.js +12 -11
  92. package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hans.json +3 -3
  93. package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hant.json +3 -3
  94. package/dist/uni/uni-ui/uni-pagination/uni-pagination.vue +450 -433
  95. package/dist/uni/uni-ui/uni-popup/uni-popup.vue +404 -404
  96. package/dist/uni/uni-ui/uni-popup-dialog/keypress.js +42 -42
  97. package/dist/uni/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +1 -0
  98. package/dist/uni/uni-ui/uni-popup-message/uni-popup-message.vue +126 -125
  99. package/dist/uni/uni-ui/uni-popup-share/uni-popup-share.vue +172 -172
  100. package/dist/uni/uni-ui/uni-rate/uni-rate.vue +343 -347
  101. package/dist/uni/uni-ui/uni-row/uni-row.vue +180 -182
  102. package/dist/uni/uni-ui/uni-scss/changelog.md +11 -4
  103. package/dist/uni/uni-ui/uni-scss/package.json +73 -73
  104. package/dist/uni/uni-ui/uni-scss/readme.md +2 -1
  105. package/dist/uni/uni-ui/uni-scss/styles/setting/_border.scss +2 -2
  106. package/dist/uni/uni-ui/uni-scss/styles/setting/_color.scss +46 -47
  107. package/dist/uni/uni-ui/uni-scss/styles/setting/_radius.scss +49 -49
  108. package/dist/uni/uni-ui/uni-scss/styles/setting/_space.scss +52 -53
  109. package/dist/uni/uni-ui/uni-scss/styles/setting/_styles.scss +142 -147
  110. package/dist/uni/uni-ui/uni-scss/styles/setting/_text.scss +20 -20
  111. package/dist/uni/uni-ui/uni-scss/styles/setting/_variables.scss +111 -95
  112. package/dist/uni/uni-ui/uni-scss/styles/tools/functions.scss +28 -18
  113. package/dist/uni/uni-ui/uni-scss/theme.scss +10 -7
  114. package/dist/uni/uni-ui/uni-scss/variables.scss +42 -24
  115. package/dist/uni/uni-ui/uni-search-bar/i18n/en.json +3 -3
  116. package/dist/uni/uni-ui/uni-search-bar/i18n/index.js +8 -7
  117. package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hans.json +2 -2
  118. package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hant.json +2 -2
  119. package/dist/uni/uni-ui/uni-search-bar/uni-search-bar.vue +290 -281
  120. package/dist/uni/uni-ui/uni-section/uni-section.vue +149 -146
  121. package/dist/uni/uni-ui/uni-segmented-control/uni-segmented-control.vue +141 -131
  122. package/dist/uni/uni-ui/uni-steps/uni-steps.vue +255 -236
  123. package/dist/uni/uni-ui/uni-swipe-action/uni-swipe-action.vue +51 -51
  124. package/dist/uni/uni-ui/uni-swipe-action-item/bindingx.js +276 -282
  125. package/dist/uni/uni-ui/uni-swipe-action-item/isPC.js +10 -10
  126. package/dist/uni/uni-ui/uni-swipe-action-item/mpalipay.js +182 -187
  127. package/dist/uni/uni-ui/uni-swipe-action-item/mpother.js +235 -244
  128. package/dist/uni/uni-ui/uni-swipe-action-item/mpwxs.js +70 -75
  129. package/dist/uni/uni-ui/uni-swipe-action-item/render.js +238 -247
  130. package/dist/uni/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +387 -313
  131. package/dist/uni/uni-ui/uni-swipe-action-item/wx.wxs +206 -215
  132. package/dist/uni/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +241 -197
  133. package/dist/uni/uni-ui/uni-table/uni-table.vue +445 -447
  134. package/dist/uni/uni-ui/uni-tag/uni-tag.vue +234 -244
  135. package/dist/uni/uni-ui/uni-tbody/uni-tbody.vue +20 -23
  136. package/dist/uni/uni-ui/uni-td/uni-td.vue +79 -80
  137. package/dist/uni/uni-ui/uni-th/filter-dropdown.vue +510 -503
  138. package/dist/uni/uni-ui/uni-th/uni-th.vue +289 -273
  139. package/dist/uni/uni-ui/uni-thead/uni-thead.vue +115 -114
  140. package/dist/uni/uni-ui/uni-title/uni-title.vue +151 -154
  141. package/dist/uni/uni-ui/uni-tooltip/uni-tooltip.vue +55 -60
  142. package/dist/uni/uni-ui/uni-tr/table-checkbox.vue +162 -163
  143. package/dist/uni/uni-ui/uni-tr/uni-tr.vue +158 -157
  144. package/dist/uni/uni-ui/uni-transition/createAnimation.js +130 -113
  145. package/dist/uni/uni-ui/uni-transition/uni-transition.vue +274 -272
  146. package/package.json +1 -1
@@ -1,357 +1,355 @@
1
1
  <template>
2
- <view class="uni-navbar" :class="{'uni-dark':dark, 'uni-nvue-fixed': fixed}">
3
- <view class="uni-navbar__content" :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }"
4
- :style="{ 'background-color': themeBgColor, 'border-bottom-color':themeColor }" >
5
- <status-bar v-if="statusBar" />
6
- <view :style="{ color: themeColor,backgroundColor: themeBgColor ,height:navbarHeight}"
7
- class="uni-navbar__header">
8
- <view @tap="onClickLeft" class="uni-navbar__header-btns uni-navbar__header-btns-left"
9
- :style="{width:leftIconWidth}">
10
- <slot name="left">
11
- <view class="uni-navbar__content_view" v-if="leftIcon.length > 0">
12
- <uni-icons :color="themeColor" :type="leftIcon" size="20" />
13
- </view>
14
- <view :class="{ 'uni-navbar-btn-icon-left': !leftIcon.length > 0 }" class="uni-navbar-btn-text"
15
- v-if="leftText.length">
16
- <text :style="{ color: themeColor, fontSize: '12px' }">{{ leftText }}</text>
17
- </view>
18
- </slot>
19
- </view>
20
- <view class="uni-navbar__header-container " @tap="onClickTitle">
21
- <slot>
22
- <view class="uni-navbar__header-container-inner" v-if="title.length>0">
23
- <text class="uni-nav-bar-text uni-ellipsis-1"
24
- :style="{color: themeColor }">{{ title }}</text>
25
- </view>
26
- </slot>
27
- </view>
28
- <view @click="onClickRight" class="uni-navbar__header-btns uni-navbar__header-btns-right"
29
- :style="{width:rightIconWidth}">
30
- <slot name="right">
31
- <view v-if="rightIcon.length">
32
- <uni-icons :color="themeColor" :type="rightIcon" size="22" />
33
- </view>
34
- <view class="uni-navbar-btn-text" v-if="rightText.length && !rightIcon.length">
35
- <text class="uni-nav-bar-right-text" :style="{ color: themeColor}">{{ rightText }}</text>
36
- </view>
37
- </slot>
38
- </view>
39
- </view>
40
- </view>
41
- <!-- #ifndef APP-NVUE -->
42
- <view class="uni-navbar__placeholder" v-if="fixed">
43
- <status-bar v-if="statusBar" />
44
- <view class="uni-navbar__placeholder-view" :style="{ height:navbarHeight}" />
45
- </view>
46
- <!-- #endif -->
47
- </view>
2
+ <view class="uni-navbar" :class="{ 'uni-dark': dark, 'uni-nvue-fixed': fixed }">
3
+ <view
4
+ class="uni-navbar__content"
5
+ :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }"
6
+ :style="{ 'background-color': themeBgColor, 'border-bottom-color': themeColor }"
7
+ >
8
+ <status-bar v-if="statusBar" />
9
+ <view :style="{ color: themeColor, backgroundColor: themeBgColor, height: navbarHeight }" class="uni-navbar__header">
10
+ <view @tap="onClickLeft" class="uni-navbar__header-btns uni-navbar__header-btns-left" :style="{ width: leftIconWidth }">
11
+ <slot name="left">
12
+ <view class="uni-navbar__content_view" v-if="leftIcon.length > 0">
13
+ <uni-icons :color="themeColor" :type="leftIcon" size="20" />
14
+ </view>
15
+ <view :class="{ 'uni-navbar-btn-icon-left': !leftIcon.length > 0 }" class="uni-navbar-btn-text" v-if="leftText.length">
16
+ <text :style="{ color: themeColor, fontSize: '12px' }">{{ leftText }}</text>
17
+ </view>
18
+ </slot>
19
+ </view>
20
+ <view class="uni-navbar__header-container" @tap="onClickTitle">
21
+ <slot>
22
+ <view class="uni-navbar__header-container-inner" v-if="title.length > 0">
23
+ <text class="uni-nav-bar-text uni-ellipsis-1" :style="{ color: themeColor }">{{ title }}</text>
24
+ </view>
25
+ </slot>
26
+ </view>
27
+ <view @click="onClickRight" class="uni-navbar__header-btns uni-navbar__header-btns-right" :style="{ width: rightIconWidth }">
28
+ <slot name="right">
29
+ <view v-if="rightIcon.length">
30
+ <uni-icons :color="themeColor" :type="rightIcon" size="22" />
31
+ </view>
32
+ <view class="uni-navbar-btn-text" v-if="rightText.length && !rightIcon.length">
33
+ <text class="uni-nav-bar-right-text" :style="{ color: themeColor }">{{ rightText }}</text>
34
+ </view>
35
+ </slot>
36
+ </view>
37
+ </view>
38
+ </view>
39
+ <!-- #ifndef APP-NVUE -->
40
+ <view class="uni-navbar__placeholder" v-if="fixed">
41
+ <status-bar v-if="statusBar" />
42
+ <view class="uni-navbar__placeholder-view" :style="{ height: navbarHeight }" />
43
+ </view>
44
+ <!-- #endif -->
45
+ </view>
48
46
  </template>
49
47
 
50
48
  <script>
51
- import statusBar from "./uni-status-bar.vue";
52
- const getVal = (val) => typeof val === 'number' ? val + 'px' : val;
49
+ import statusBar from './uni-status-bar.vue';
53
50
 
54
- /**
55
- *
56
- *
57
- * NavBar 自定义导航栏
58
- * @description 导航栏组件,主要用于头部导航
59
- * @tutorial https://ext.dcloud.net.cn/plugin?id=52
60
- * @property {Boolean} dark 开启黑暗模式
61
- * @property {String} title 标题文字
62
- * @property {String} leftText 左侧按钮文本
63
- * @property {String} rightText 右侧按钮文本
64
- * @property {String} leftIcon 左侧按钮图标(图标类型参考 [Icon 图标](http://ext.dcloud.net.cn/plugin?id=28) type 属性)
65
- * @property {String} rightIcon 右侧按钮图标(图标类型参考 [Icon 图标](http://ext.dcloud.net.cn/plugin?id=28) type 属性)
66
- * @property {String} color 图标和文字颜色
67
- * @property {String} backgroundColor 导航栏背景颜色
68
- * @property {Boolean} fixed = [true|false] 是否固定顶部
69
- * @property {Boolean} statusBar = [true|false] 是否包含状态栏
70
- * @property {Boolean} shadow = [true|false] 导航栏下是否有阴影
71
- * @property {Boolean} stat 是否开启统计标题上报
72
- * @event {Function} clickLeft 左侧按钮点击时触发
73
- * @event {Function} clickRight 右侧按钮点击时触发
74
- * @event {Function} clickTitle 中间标题点击时触发
75
- */
76
- export default {
77
- name: "UniNavBar",
78
- components: {
79
- statusBar
80
- },
81
- emits: ['clickLeft', 'clickRight', 'clickTitle'],
82
- props: {
83
- dark: {
84
- type: Boolean,
85
- default: false
86
- },
87
- title: {
88
- type: String,
89
- default: ""
90
- },
91
- leftText: {
92
- type: String,
93
- default: ""
94
- },
95
- rightText: {
96
- type: String,
97
- default: ""
98
- },
99
- leftIcon: {
100
- type: String,
101
- default: ""
102
- },
103
- rightIcon: {
104
- type: String,
105
- default: ""
106
- },
107
- fixed: {
108
- type: [Boolean, String],
109
- default: false
110
- },
111
- color: {
112
- type: String,
113
- default: ""
114
- },
115
- backgroundColor: {
116
- type: String,
117
- default: ""
118
- },
119
- statusBar: {
120
- type: [Boolean, String],
121
- default: false
122
- },
123
- shadow: {
124
- type: [Boolean, String],
125
- default: false
126
- },
127
- border: {
128
- type: [Boolean, String],
129
- default: true
130
- },
131
- height: {
132
- type: [Number, String],
133
- default: 44
134
- },
135
- leftWidth: {
136
- type: [Number, String],
137
- default: 60
138
- },
139
- rightWidth: {
140
- type: [Number, String],
141
- default: 60
142
- },
143
- stat: {
144
- type: [Boolean, String],
145
- default: ''
146
- }
147
- },
148
- computed: {
149
- themeBgColor() {
150
- if (this.dark) {
151
- // 默认值
152
- if (this.backgroundColor) {
153
- return this.backgroundColor
154
- } else {
155
- return this.dark ? '#333' : '#FFF'
156
- }
157
- }
158
- return this.backgroundColor || '#FFF'
159
- },
160
- themeColor() {
161
- if (this.dark) {
162
- // 默认值
163
- if (this.color) {
164
- return this.color
165
- } else {
166
- return this.dark ? '#fff' : '#333'
167
- }
168
- }
169
- return this.color || '#333'
170
- },
171
- navbarHeight() {
172
- return getVal(this.height)
173
- },
174
- leftIconWidth() {
175
- return getVal(this.leftWidth)
176
- },
177
- rightIconWidth() {
178
- return getVal(this.rightWidth)
179
- }
180
- },
181
- mounted() {
182
- if (uni.report && this.stat && this.title !== '') {
183
- uni.report('title', this.title)
184
- }
185
- },
186
- methods: {
187
- onClickLeft() {
188
- this.$emit("clickLeft");
189
- },
190
- onClickRight() {
191
- this.$emit("clickRight");
192
- },
193
- onClickTitle() {
194
- this.$emit("clickTitle");
195
- }
196
- }
197
- };
51
+ const getVal = (val) => (typeof val === 'number' ? val + 'px' : val);
52
+
53
+ /**
54
+ *
55
+ *
56
+ * NavBar 自定义导航栏
57
+ * @description 导航栏组件,主要用于头部导航
58
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=52
59
+ * @property {Boolean} dark 开启黑暗模式
60
+ * @property {String} title 标题文字
61
+ * @property {String} leftText 左侧按钮文本
62
+ * @property {String} rightText 右侧按钮文本
63
+ * @property {String} leftIcon 左侧按钮图标(图标类型参考 [Icon 图标](http://ext.dcloud.net.cn/plugin?id=28) type 属性)
64
+ * @property {String} rightIcon 右侧按钮图标(图标类型参考 [Icon 图标](http://ext.dcloud.net.cn/plugin?id=28) type 属性)
65
+ * @property {String} color 图标和文字颜色
66
+ * @property {String} backgroundColor 导航栏背景颜色
67
+ * @property {Boolean} fixed = [true|false] 是否固定顶部
68
+ * @property {Boolean} statusBar = [true|false] 是否包含状态栏
69
+ * @property {Boolean} shadow = [true|false] 导航栏下是否有阴影
70
+ * @property {Boolean} stat 是否开启统计标题上报
71
+ * @event {Function} clickLeft 左侧按钮点击时触发
72
+ * @event {Function} clickRight 右侧按钮点击时触发
73
+ * @event {Function} clickTitle 中间标题点击时触发
74
+ */
75
+ export default {
76
+ name: 'UniNavBar',
77
+ components: {
78
+ statusBar,
79
+ },
80
+ emits: ['clickLeft', 'clickRight', 'clickTitle'],
81
+ props: {
82
+ dark: {
83
+ type: Boolean,
84
+ default: false,
85
+ },
86
+ title: {
87
+ type: String,
88
+ default: '',
89
+ },
90
+ leftText: {
91
+ type: String,
92
+ default: '',
93
+ },
94
+ rightText: {
95
+ type: String,
96
+ default: '',
97
+ },
98
+ leftIcon: {
99
+ type: String,
100
+ default: '',
101
+ },
102
+ rightIcon: {
103
+ type: String,
104
+ default: '',
105
+ },
106
+ fixed: {
107
+ type: [Boolean, String],
108
+ default: false,
109
+ },
110
+ color: {
111
+ type: String,
112
+ default: '',
113
+ },
114
+ backgroundColor: {
115
+ type: String,
116
+ default: '',
117
+ },
118
+ statusBar: {
119
+ type: [Boolean, String],
120
+ default: false,
121
+ },
122
+ shadow: {
123
+ type: [Boolean, String],
124
+ default: false,
125
+ },
126
+ border: {
127
+ type: [Boolean, String],
128
+ default: true,
129
+ },
130
+ height: {
131
+ type: [Number, String],
132
+ default: 44,
133
+ },
134
+ leftWidth: {
135
+ type: [Number, String],
136
+ default: 60,
137
+ },
138
+ rightWidth: {
139
+ type: [Number, String],
140
+ default: 60,
141
+ },
142
+ stat: {
143
+ type: [Boolean, String],
144
+ default: '',
145
+ },
146
+ },
147
+ computed: {
148
+ themeBgColor() {
149
+ if (this.dark) {
150
+ // 默认值
151
+ if (this.backgroundColor) {
152
+ return this.backgroundColor;
153
+ } else {
154
+ return this.dark ? '#333' : '#FFF';
155
+ }
156
+ }
157
+ return this.backgroundColor || '#FFF';
158
+ },
159
+ themeColor() {
160
+ if (this.dark) {
161
+ // 默认值
162
+ if (this.color) {
163
+ return this.color;
164
+ } else {
165
+ return this.dark ? '#fff' : '#333';
166
+ }
167
+ }
168
+ return this.color || '#333';
169
+ },
170
+ navbarHeight() {
171
+ return getVal(this.height);
172
+ },
173
+ leftIconWidth() {
174
+ return getVal(this.leftWidth);
175
+ },
176
+ rightIconWidth() {
177
+ return getVal(this.rightWidth);
178
+ },
179
+ },
180
+ mounted() {
181
+ if (uni.report && this.stat && this.title !== '') {
182
+ uni.report('title', this.title);
183
+ }
184
+ },
185
+ methods: {
186
+ onClickLeft() {
187
+ this.$emit('clickLeft');
188
+ },
189
+ onClickRight() {
190
+ this.$emit('clickRight');
191
+ },
192
+ onClickTitle() {
193
+ this.$emit('clickTitle');
194
+ },
195
+ },
196
+ };
198
197
  </script>
199
198
 
200
199
  <style lang="scss" scoped>
201
- $nav-height: 44px;
202
-
203
- .uni-nvue-fixed {
204
- /* #ifdef APP-NVUE */
205
- position: sticky;
206
- /* #endif */
207
- }
208
- .uni-navbar {
209
- // box-sizing: border-box;
210
- }
211
-
212
- .uni-nav-bar-text {
213
- /* #ifdef APP-PLUS */
214
- font-size: 34rpx;
215
- /* #endif */
216
- /* #ifndef APP-PLUS */
217
- font-size: 14px;
218
- /* #endif */
219
- }
200
+ $nav-height: 44px;
220
201
 
221
- .uni-nav-bar-right-text {
222
- font-size: 12px;
223
- }
202
+ .uni-nvue-fixed {
203
+ /* #ifdef APP-NVUE */
204
+ position: sticky;
205
+ /* #endif */
206
+ }
207
+ .uni-navbar {
208
+ // box-sizing: border-box;
209
+ }
224
210
 
225
- .uni-navbar__content {
226
- position: relative;
227
- // background-color: #fff;
228
- // box-sizing: border-box;
229
- background-color: transparent;
230
- }
211
+ .uni-nav-bar-text {
212
+ /* #ifdef APP-PLUS */
213
+ font-size: 34rpx;
214
+ /* #endif */
215
+ /* #ifndef APP-PLUS */
216
+ font-size: 14px;
217
+ /* #endif */
218
+ }
231
219
 
232
- .uni-navbar__content_view {
233
- // box-sizing: border-box;
234
- }
220
+ .uni-nav-bar-right-text {
221
+ font-size: 12px;
222
+ }
235
223
 
236
- .uni-navbar-btn-text {
237
- /* #ifndef APP-NVUE */
238
- display: flex;
239
- /* #endif */
240
- flex-direction: column;
241
- justify-content: flex-start;
242
- align-items: center;
243
- line-height: 12px;
244
- }
224
+ .uni-navbar__content {
225
+ position: relative;
226
+ // background-color: #fff;
227
+ // box-sizing: border-box;
228
+ background-color: transparent;
229
+ }
245
230
 
246
- .uni-navbar__header {
247
- /* #ifndef APP-NVUE */
248
- display: flex;
249
- /* #endif */
250
- padding: 0 10px;
251
- flex-direction: row;
252
- height: $nav-height;
253
- font-size: 12px;
254
- }
231
+ .uni-navbar__content_view {
232
+ // box-sizing: border-box;
233
+ }
255
234
 
256
- .uni-navbar__header-btns {
257
- /* #ifndef APP-NVUE */
258
- overflow: hidden;
259
- display: flex;
260
- /* #endif */
261
- flex-wrap: nowrap;
262
- flex-direction: row;
263
- width: 120rpx;
264
- // padding: 0 6px;
265
- justify-content: center;
266
- align-items: center;
267
- /* #ifdef H5 */
268
- cursor: pointer;
269
- /* #endif */
270
- }
235
+ .uni-navbar-btn-text {
236
+ /* #ifndef APP-NVUE */
237
+ display: flex;
238
+ /* #endif */
239
+ flex-direction: column;
240
+ justify-content: flex-start;
241
+ align-items: center;
242
+ line-height: 12px;
243
+ }
271
244
 
272
- .uni-navbar__header-btns-left {
273
- /* #ifndef APP-NVUE */
274
- display: flex;
275
- /* #endif */
276
- width: 120rpx;
277
- justify-content: flex-start;
278
- align-items: center;
279
- }
245
+ .uni-navbar__header {
246
+ /* #ifndef APP-NVUE */
247
+ display: flex;
248
+ /* #endif */
249
+ padding: 0 10px;
250
+ flex-direction: row;
251
+ height: $nav-height;
252
+ font-size: 12px;
253
+ }
280
254
 
281
- .uni-navbar__header-btns-right {
282
- /* #ifndef APP-NVUE */
283
- display: flex;
284
- /* #endif */
285
- flex-direction: row;
286
- // width: 150rpx;
287
- // padding-right: 30rpx;
288
- justify-content: flex-end;
289
- align-items: center;
290
- }
255
+ .uni-navbar__header-btns {
256
+ /* #ifndef APP-NVUE */
257
+ overflow: hidden;
258
+ display: flex;
259
+ /* #endif */
260
+ flex-wrap: nowrap;
261
+ flex-direction: row;
262
+ width: 120rpx;
263
+ // padding: 0 6px;
264
+ justify-content: center;
265
+ align-items: center;
266
+ /* #ifdef H5 */
267
+ cursor: pointer;
268
+ /* #endif */
269
+ }
291
270
 
292
- .uni-navbar__header-container {
293
- /* #ifndef APP-NVUE */
294
- display: flex;
295
- /* #endif */
296
- flex: 1;
297
- padding: 0 10px;
298
- overflow: hidden;
299
- }
271
+ .uni-navbar__header-btns-left {
272
+ /* #ifndef APP-NVUE */
273
+ display: flex;
274
+ /* #endif */
275
+ width: 120rpx;
276
+ justify-content: flex-start;
277
+ align-items: center;
278
+ }
300
279
 
301
- .uni-navbar__header-container-inner {
302
- /* #ifndef APP-NVUE */
303
- display: flex;
304
- /* #endif */
305
- flex: 1;
306
- flex-direction: row;
307
- align-items: center;
308
- justify-content: center;
309
- font-size: 12px;
310
- overflow: hidden;
311
- // box-sizing: border-box;
312
- }
280
+ .uni-navbar__header-btns-right {
281
+ /* #ifndef APP-NVUE */
282
+ display: flex;
283
+ /* #endif */
284
+ flex-direction: row;
285
+ // width: 150rpx;
286
+ // padding-right: 30rpx;
287
+ justify-content: flex-end;
288
+ align-items: center;
289
+ }
313
290
 
291
+ .uni-navbar__header-container {
292
+ /* #ifndef APP-NVUE */
293
+ display: flex;
294
+ /* #endif */
295
+ flex: 1;
296
+ padding: 0 10px;
297
+ overflow: hidden;
298
+ }
314
299
 
315
- .uni-navbar__placeholder-view {
316
- height: $nav-height;
317
- }
300
+ .uni-navbar__header-container-inner {
301
+ /* #ifndef APP-NVUE */
302
+ display: flex;
303
+ /* #endif */
304
+ flex: 1;
305
+ flex-direction: row;
306
+ align-items: center;
307
+ justify-content: center;
308
+ font-size: 12px;
309
+ overflow: hidden;
310
+ // box-sizing: border-box;
311
+ }
318
312
 
319
- .uni-navbar--fixed {
320
- position: fixed;
321
- z-index: 998;
322
- /* #ifdef H5 */
323
- left: var(--window-left);
324
- right: var(--window-right);
325
- /* #endif */
326
- /* #ifndef H5 */
327
- left: 0;
328
- right: 0;
329
- /* #endif */
313
+ .uni-navbar__placeholder-view {
314
+ height: $nav-height;
315
+ }
330
316
 
331
- }
317
+ .uni-navbar--fixed {
318
+ position: fixed;
319
+ z-index: 998;
320
+ /* #ifdef H5 */
321
+ left: var(--window-left);
322
+ right: var(--window-right);
323
+ /* #endif */
324
+ /* #ifndef H5 */
325
+ left: 0;
326
+ right: 0;
327
+ /* #endif */
328
+ }
332
329
 
333
- .uni-navbar--shadow {
334
- box-shadow: 0 1px 6px #ccc;
335
- }
330
+ .uni-navbar--shadow {
331
+ box-shadow: 0 1px 6px #ccc;
332
+ }
336
333
 
337
- .uni-navbar--border {
338
- border-bottom-width: 1rpx;
339
- border-bottom-style: solid;
340
- border-bottom-color: #eee;
341
- }
334
+ .uni-navbar--border {
335
+ border-bottom-width: 1rpx;
336
+ border-bottom-style: solid;
337
+ border-bottom-color: #eee;
338
+ }
342
339
 
343
- .uni-ellipsis-1 {
344
- overflow: hidden;
345
- /* #ifndef APP-NVUE */
346
- white-space: nowrap;
347
- text-overflow: ellipsis;
348
- /* #endif */
349
- /* #ifdef APP-NVUE */
350
- lines: 1;
351
- text-overflow: ellipsis;
352
- /* #endif */
353
- }
340
+ .uni-ellipsis-1 {
341
+ overflow: hidden;
342
+ /* #ifndef APP-NVUE */
343
+ white-space: nowrap;
344
+ text-overflow: ellipsis;
345
+ /* #endif */
346
+ /* #ifdef APP-NVUE */
347
+ lines: 1;
348
+ text-overflow: ellipsis;
349
+ /* #endif */
350
+ }
354
351
 
355
- // 暗主题配置
356
- .uni-dark {}
352
+ // 暗主题配置
353
+ .uni-dark {
354
+ }
357
355
  </style>