@gmcb/uv-ui 0.2.26
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/CHANGELOG.md +295 -0
- package/LICENSE +21 -0
- package/README.md +164 -0
- package/components/uv-action-sheet/props.js +50 -0
- package/components/uv-action-sheet/uv-action-sheet.vue +280 -0
- package/components/uv-album/uv-album.vue +312 -0
- package/components/uv-alert/props.js +45 -0
- package/components/uv-alert/uv-alert.vue +246 -0
- package/components/uv-avatar/props.js +85 -0
- package/components/uv-avatar/uv-avatar.vue +182 -0
- package/components/uv-avatar-group/props.js +53 -0
- package/components/uv-avatar-group/uv-avatar-group.vue +106 -0
- package/components/uv-back-top/props.js +58 -0
- package/components/uv-back-top/uv-back-top.vue +116 -0
- package/components/uv-badge/props.js +73 -0
- package/components/uv-badge/uv-badge.vue +176 -0
- package/components/uv-button/nvue.scss +46 -0
- package/components/uv-button/props.js +163 -0
- package/components/uv-button/uv-button.vue +529 -0
- package/components/uv-button/vue.scss +93 -0
- package/components/uv-calendar/calendar.js +546 -0
- package/components/uv-calendar/header.vue +104 -0
- package/components/uv-calendar/month.vue +616 -0
- package/components/uv-calendar/props.js +145 -0
- package/components/uv-calendar/uv-calendar.vue +390 -0
- package/components/uv-calendars/calendar-body.vue +376 -0
- package/components/uv-calendars/calendar-item.vue +248 -0
- package/components/uv-calendars/calendar.js +546 -0
- package/components/uv-calendars/i18n/en.json +12 -0
- package/components/uv-calendars/i18n/index.js +8 -0
- package/components/uv-calendars/i18n/zh-Hans.json +12 -0
- package/components/uv-calendars/i18n/zh-Hant.json +12 -0
- package/components/uv-calendars/util.js +435 -0
- package/components/uv-calendars/uv-calendars.vue +452 -0
- package/components/uv-cell/props.js +116 -0
- package/components/uv-cell/uv-cell.vue +209 -0
- package/components/uv-cell-group/props.js +15 -0
- package/components/uv-cell-group/uv-cell-group.vue +63 -0
- package/components/uv-checkbox/props.js +70 -0
- package/components/uv-checkbox/uv-checkbox.vue +371 -0
- package/components/uv-checkbox-group/props.js +84 -0
- package/components/uv-checkbox-group/uv-checkbox-group.vue +119 -0
- package/components/uv-code/props.js +35 -0
- package/components/uv-code/uv-code.vue +136 -0
- package/components/uv-code-input/props.js +83 -0
- package/components/uv-code-input/uv-code-input.vue +272 -0
- package/components/uv-col/props.js +30 -0
- package/components/uv-col/uv-col.vue +165 -0
- package/components/uv-collapse/props.js +20 -0
- package/components/uv-collapse/uv-collapse.vue +86 -0
- package/components/uv-collapse-item/props.js +60 -0
- package/components/uv-collapse-item/uv-collapse-item.vue +228 -0
- package/components/uv-column-notice/props.js +61 -0
- package/components/uv-column-notice/uv-column-notice.vue +176 -0
- package/components/uv-count-down/props.js +25 -0
- package/components/uv-count-down/utils.js +62 -0
- package/components/uv-count-down/uv-count-down.vue +169 -0
- package/components/uv-count-to/props.js +60 -0
- package/components/uv-count-to/uv-count-to.vue +187 -0
- package/components/uv-datetime-picker/props.js +130 -0
- package/components/uv-datetime-picker/uv-datetime-picker.vue +355 -0
- package/components/uv-divider/props.js +45 -0
- package/components/uv-divider/uv-divider.vue +113 -0
- package/components/uv-drop-down/uv-drop-down.vue +135 -0
- package/components/uv-drop-down-item/uv-drop-down-item.vue +169 -0
- package/components/uv-drop-down-popup/uv-drop-down-popup.vue +242 -0
- package/components/uv-empty/props.js +60 -0
- package/components/uv-empty/uv-empty.vue +126 -0
- package/components/uv-form/props.js +46 -0
- package/components/uv-form/uv-form.vue +209 -0
- package/components/uv-form/valid.js +1343 -0
- package/components/uv-form-item/props.js +49 -0
- package/components/uv-form-item/uv-form-item.vue +226 -0
- package/components/uv-gap/props.js +25 -0
- package/components/uv-gap/uv-gap.vue +36 -0
- package/components/uv-grid/props.js +20 -0
- package/components/uv-grid/uv-grid.vue +100 -0
- package/components/uv-grid-item/props.js +15 -0
- package/components/uv-grid-item/uv-grid-item.vue +223 -0
- package/components/uv-icon/icons.js +160 -0
- package/components/uv-icon/props.js +90 -0
- package/components/uv-icon/uv-icon.vue +226 -0
- package/components/uv-icon/uvicons.ttf +0 -0
- package/components/uv-image/props.js +100 -0
- package/components/uv-image/uv-image.vue +296 -0
- package/components/uv-index-anchor/props.js +30 -0
- package/components/uv-index-anchor/uv-index-anchor.vue +98 -0
- package/components/uv-index-item/uv-index-item.vue +87 -0
- package/components/uv-index-list/props.js +30 -0
- package/components/uv-index-list/uv-index-list.vue +461 -0
- package/components/uv-input/props.js +175 -0
- package/components/uv-input/uv-input.vue +348 -0
- package/components/uv-keyboard/props.js +95 -0
- package/components/uv-keyboard/uv-keyboard.vue +180 -0
- package/components/uv-keyboard-car/props.js +24 -0
- package/components/uv-keyboard-car/uv-keyboard-car.vue +347 -0
- package/components/uv-keyboard-number/props.js +19 -0
- package/components/uv-keyboard-number/uv-keyboard-number.vue +201 -0
- package/components/uv-line/props.js +34 -0
- package/components/uv-line/uv-line.vue +60 -0
- package/components/uv-line-progress/props.js +29 -0
- package/components/uv-line-progress/uv-line-progress.vue +146 -0
- package/components/uv-link/props.js +40 -0
- package/components/uv-link/uv-link.vue +83 -0
- package/components/uv-list/uv-list.vue +147 -0
- package/components/uv-list-item/uv-list-item.vue +535 -0
- package/components/uv-load-more/props.js +95 -0
- package/components/uv-load-more/uv-load-more.vue +152 -0
- package/components/uv-loading-icon/props.js +67 -0
- package/components/uv-loading-icon/uv-loading-icon.vue +347 -0
- package/components/uv-loading-page/props.js +55 -0
- package/components/uv-loading-page/uv-loading-page.vue +96 -0
- package/components/uv-modal/props.js +90 -0
- package/components/uv-modal/uv-modal.vue +245 -0
- package/components/uv-navbar/props.js +89 -0
- package/components/uv-navbar/uv-navbar.vue +245 -0
- package/components/uv-no-network/props.js +20 -0
- package/components/uv-no-network/uv-no-network.vue +222 -0
- package/components/uv-notice-bar/props.js +76 -0
- package/components/uv-notice-bar/uv-notice-bar.vue +110 -0
- package/components/uv-notify/props.js +45 -0
- package/components/uv-notify/uv-notify.vue +220 -0
- package/components/uv-number-box/props.js +118 -0
- package/components/uv-number-box/uv-number-box.vue +397 -0
- package/components/uv-overlay/props.js +25 -0
- package/components/uv-overlay/uv-overlay.vue +85 -0
- package/components/uv-parse/node/node.vue +576 -0
- package/components/uv-parse/parser.js +1335 -0
- package/components/uv-parse/uv-parse.vue +498 -0
- package/components/uv-pick-color/colors.js +217 -0
- package/components/uv-pick-color/props.js +47 -0
- package/components/uv-pick-color/uv-pick-color.vue +551 -0
- package/components/uv-picker/props.js +95 -0
- package/components/uv-picker/uv-picker.vue +329 -0
- package/components/uv-popup/keypress.js +45 -0
- package/components/uv-popup/uv-popup.vue +537 -0
- package/components/uv-preview-video/uv-preview-video.vue +52 -0
- package/components/uv-qrcode/cache.js +1 -0
- package/components/uv-qrcode/gcanvas/bridge/bridge-weex.js +241 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStyleLinearGradient.js +18 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStylePattern.js +8 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStyleRadialGradient.js +17 -0
- package/components/uv-qrcode/gcanvas/context-2d/RenderingContext.js +666 -0
- package/components/uv-qrcode/gcanvas/context-webgl/ActiveInfo.js +11 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Buffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Framebuffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLenum.js +298 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLmethod.js +142 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLtype.js +23 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Program.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Renderbuffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/RenderingContext.js +1191 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Shader.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/ShaderPrecisionFormat.js +11 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Texture.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/UniformLocation.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/classUtils.js +3 -0
- package/components/uv-qrcode/gcanvas/env/canvas.js +74 -0
- package/components/uv-qrcode/gcanvas/env/image.js +96 -0
- package/components/uv-qrcode/gcanvas/env/tool.js +24 -0
- package/components/uv-qrcode/gcanvas/index.js +39 -0
- package/components/uv-qrcode/props.js +85 -0
- package/components/uv-qrcode/qrcode.js +34 -0
- package/components/uv-qrcode/queue.js +41 -0
- package/components/uv-qrcode/uv-qrcode.vue +1038 -0
- package/components/uv-radio/props.js +65 -0
- package/components/uv-radio/uv-radio.vue +349 -0
- package/components/uv-radio-group/props.js +89 -0
- package/components/uv-radio-group/uv-radio-group.vue +115 -0
- package/components/uv-rate/props.js +73 -0
- package/components/uv-rate/uv-rate.vue +274 -0
- package/components/uv-read-more/props.js +62 -0
- package/components/uv-read-more/uv-read-more.vue +162 -0
- package/components/uv-row/props.js +20 -0
- package/components/uv-row/uv-row.vue +95 -0
- package/components/uv-row-notice/props.js +40 -0
- package/components/uv-row-notice/uv-row-notice.vue +341 -0
- package/components/uv-safe-bottom/uv-safe-bottom.vue +67 -0
- package/components/uv-scroll-list/nvue.js +29 -0
- package/components/uv-scroll-list/props.js +35 -0
- package/components/uv-scroll-list/scrollWxs.wxs +51 -0
- package/components/uv-scroll-list/uv-scroll-list.vue +218 -0
- package/components/uv-search/props.js +127 -0
- package/components/uv-search/uv-search.vue +311 -0
- package/components/uv-skeleton/props.js +65 -0
- package/components/uv-skeleton/uv-skeleton.vue +250 -0
- package/components/uv-skeletons/uv-skeletons.vue +247 -0
- package/components/uv-slider/props.js +58 -0
- package/components/uv-slider/uv-slider.vue +58 -0
- package/components/uv-status-bar/props.js +8 -0
- package/components/uv-status-bar/uv-status-bar.vue +54 -0
- package/components/uv-steps/props.js +40 -0
- package/components/uv-steps/uv-steps.vue +83 -0
- package/components/uv-steps-item/props.js +25 -0
- package/components/uv-steps-item/uv-steps-item.vue +347 -0
- package/components/uv-sticky/props.js +41 -0
- package/components/uv-sticky/uv-sticky.vue +223 -0
- package/components/uv-subsection/props.js +54 -0
- package/components/uv-subsection/uv-subsection.vue +269 -0
- package/components/uv-swipe-action/props.js +10 -0
- package/components/uv-swipe-action/uv-swipe-action.vue +65 -0
- package/components/uv-swipe-action-item/index - backup.wxs +256 -0
- package/components/uv-swipe-action-item/index.wxs +225 -0
- package/components/uv-swipe-action-item/nvue - backup.js +264 -0
- package/components/uv-swipe-action-item/nvue.js +182 -0
- package/components/uv-swipe-action-item/props.js +40 -0
- package/components/uv-swipe-action-item/uv-swipe-action-item.vue +200 -0
- package/components/uv-swipe-action-item/wxs.js +15 -0
- package/components/uv-swiper/props.js +136 -0
- package/components/uv-swiper/uv-swiper.vue +263 -0
- package/components/uv-swiper-indicator/props.js +30 -0
- package/components/uv-swiper-indicator/uv-swiper-indicator.vue +112 -0
- package/components/uv-switch/props.js +58 -0
- package/components/uv-switch/uv-switch.vue +182 -0
- package/components/uv-tabbar/props.js +50 -0
- package/components/uv-tabbar/uv-tabbar.vue +146 -0
- package/components/uv-tabbar-item/props.js +40 -0
- package/components/uv-tabbar-item/uv-tabbar-item.vue +146 -0
- package/components/uv-tabs/props.js +71 -0
- package/components/uv-tabs/uv-tabs.vue +391 -0
- package/components/uv-tags/props.js +104 -0
- package/components/uv-tags/uv-tags.vue +379 -0
- package/components/uv-text/props.js +113 -0
- package/components/uv-text/uv-text.vue +218 -0
- package/components/uv-text/value.js +87 -0
- package/components/uv-textarea/props.js +138 -0
- package/components/uv-textarea/uv-textarea.vue +238 -0
- package/components/uv-toast/uv-toast.vue +292 -0
- package/components/uv-toolbar/props.js +40 -0
- package/components/uv-toolbar/uv-toolbar.vue +109 -0
- package/components/uv-tooltip/props.js +60 -0
- package/components/uv-tooltip/uv-tooltip.vue +372 -0
- package/components/uv-transition/createAnimation.js +131 -0
- package/components/uv-transition/props.js +31 -0
- package/components/uv-transition/uv-transition.vue +320 -0
- package/components/uv-upload/mixin.js +22 -0
- package/components/uv-upload/props.js +130 -0
- package/components/uv-upload/utils.js +151 -0
- package/components/uv-upload/uv-upload.vue +488 -0
- package/components/uv-vtabs/props.js +79 -0
- package/components/uv-vtabs/uv-vtabs.vue +438 -0
- package/components/uv-vtabs-item/uv-vtabs-item.vue +68 -0
- package/components/uv-waterfall/props.js +69 -0
- package/components/uv-waterfall/uv-waterfall.vue +265 -0
- package/index.js +82 -0
- package/index.scss +7 -0
- package/libs/config/config.js +34 -0
- package/libs/css/color.scss +32 -0
- package/libs/css/common.scss +100 -0
- package/libs/css/components.scss +23 -0
- package/libs/css/variable.scss +111 -0
- package/libs/css/vue.scss +40 -0
- package/libs/function/colorGradient.js +134 -0
- package/libs/function/compress.js +27 -0
- package/libs/function/debounce.js +29 -0
- package/libs/function/digit.js +167 -0
- package/libs/function/index.js +734 -0
- package/libs/function/platform.js +75 -0
- package/libs/function/test.js +287 -0
- package/libs/function/throttle.js +30 -0
- package/libs/luch-request/adapters/index.js +132 -0
- package/libs/luch-request/core/InterceptorManager.js +51 -0
- package/libs/luch-request/core/Request.js +201 -0
- package/libs/luch-request/core/buildFullPath.js +20 -0
- package/libs/luch-request/core/defaults.js +33 -0
- package/libs/luch-request/core/dispatchRequest.js +6 -0
- package/libs/luch-request/core/mergeConfig.js +126 -0
- package/libs/luch-request/core/settle.js +16 -0
- package/libs/luch-request/helpers/buildURL.js +64 -0
- package/libs/luch-request/helpers/combineURLs.js +14 -0
- package/libs/luch-request/helpers/isAbsoluteURL.js +14 -0
- package/libs/luch-request/index.d.ts +197 -0
- package/libs/luch-request/index.js +2 -0
- package/libs/luch-request/utils/clone.js +264 -0
- package/libs/luch-request/utils.js +135 -0
- package/libs/mixin/button.js +13 -0
- package/libs/mixin/mixin.js +172 -0
- package/libs/mixin/mpMixin.js +8 -0
- package/libs/mixin/mpShare.js +13 -0
- package/libs/mixin/openType.js +47 -0
- package/libs/mixin/touch.js +59 -0
- package/libs/util/dayjs.js +216 -0
- package/libs/util/route.js +126 -0
- package/package.json +28 -0
- package/theme.scss +43 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 返回顶部的形状,circle-圆形,square-方形
|
|
4
|
+
mode: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: 'circle'
|
|
7
|
+
},
|
|
8
|
+
// 自定义图标
|
|
9
|
+
icon: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: 'arrow-upward'
|
|
12
|
+
},
|
|
13
|
+
// 提示文字
|
|
14
|
+
text: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ''
|
|
17
|
+
},
|
|
18
|
+
// 返回顶部滚动时间
|
|
19
|
+
duration: {
|
|
20
|
+
type: [String, Number],
|
|
21
|
+
default: 100
|
|
22
|
+
},
|
|
23
|
+
// 滚动距离
|
|
24
|
+
scrollTop: {
|
|
25
|
+
type: [String, Number],
|
|
26
|
+
default: 0
|
|
27
|
+
},
|
|
28
|
+
// 距离顶部多少距离显示,单位px
|
|
29
|
+
top: {
|
|
30
|
+
type: [String, Number],
|
|
31
|
+
default: 400
|
|
32
|
+
},
|
|
33
|
+
// 返回顶部按钮到底部的距离,单位px
|
|
34
|
+
bottom: {
|
|
35
|
+
type: [String, Number],
|
|
36
|
+
default: 100
|
|
37
|
+
},
|
|
38
|
+
// 返回顶部按钮到右边的距离,单位px
|
|
39
|
+
right: {
|
|
40
|
+
type: [String, Number],
|
|
41
|
+
default: 20
|
|
42
|
+
},
|
|
43
|
+
// 层级
|
|
44
|
+
zIndex: {
|
|
45
|
+
type: [String, Number],
|
|
46
|
+
default: 9
|
|
47
|
+
},
|
|
48
|
+
// 图标的样式,对象形式
|
|
49
|
+
iconStyle: {
|
|
50
|
+
type: Object,
|
|
51
|
+
default: () => ({
|
|
52
|
+
color: '#909399',
|
|
53
|
+
fontSize: '19px'
|
|
54
|
+
})
|
|
55
|
+
},
|
|
56
|
+
...uni.$uv?.props?.backtop
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<uv-transition mode="fade" :customStyle="backTopStyle" :show="show">
|
|
3
|
+
<slot>
|
|
4
|
+
<view class="uv-back-top" :style="[contentStyle]" @click="backToTop">
|
|
5
|
+
<uv-icon :name="icon" :custom-style="iconStyle"></uv-icon>
|
|
6
|
+
<text v-if="text" class="uv-back-top__text">{{text}}</text>
|
|
7
|
+
</view>
|
|
8
|
+
</slot>
|
|
9
|
+
</uv-transition>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
14
|
+
import mixin from '../../libs/mixin/mixin.js'
|
|
15
|
+
import props from './props.js';
|
|
16
|
+
// #ifdef APP-NVUE
|
|
17
|
+
const dom = weex.requireModule('dom')
|
|
18
|
+
// #endif
|
|
19
|
+
/**
|
|
20
|
+
* backTop 返回顶部
|
|
21
|
+
* @description 本组件一个用于长页面,滑动一定距离后,出现返回顶部按钮,方便快速返回顶部的场景。
|
|
22
|
+
* @tutorial https://www.uvui.cn/components/backTop.html
|
|
23
|
+
* @property {String} mode 返回顶部的形状,circle-圆形,square-方形 (默认 'circle' )
|
|
24
|
+
* @property {String} icon 自定义图标 (默认 'arrow-upward' ) 见官方文档示例
|
|
25
|
+
* @property {String} text 提示文字
|
|
26
|
+
* @property {String | Number} duration 返回顶部滚动时间 (默认 100)
|
|
27
|
+
* @property {String | Number} scrollTop 滚动距离 (默认 0 )
|
|
28
|
+
* @property {String | Number} top 距离顶部多少距离显示,单位px (默认 400 )
|
|
29
|
+
* @property {String | Number} bottom 返回顶部按钮到底部的距离,单位px (默认 100 )
|
|
30
|
+
* @property {String | Number} right 返回顶部按钮到右边的距离,单位px (默认 20 )
|
|
31
|
+
* @property {String | Number} zIndex 层级 (默认 9 )
|
|
32
|
+
* @property {Object<Object>} iconStyle 图标的样式,对象形式 (默认 {color: '#909399',fontSize: '19px'})
|
|
33
|
+
* @property {Object} customStyle 定义需要用到的外部样式
|
|
34
|
+
*
|
|
35
|
+
* @example <uv-back-top :scrollTop="scrollTop"></uv-back-top>
|
|
36
|
+
*/
|
|
37
|
+
export default {
|
|
38
|
+
name: 'uv-back-top',
|
|
39
|
+
emits: ['click'],
|
|
40
|
+
mixins: [mpMixin, mixin, props],
|
|
41
|
+
computed: {
|
|
42
|
+
backTopStyle() {
|
|
43
|
+
// 动画组件样式
|
|
44
|
+
const style = {
|
|
45
|
+
bottom: this.$uv.addUnit(this.bottom),
|
|
46
|
+
right: this.$uv.addUnit(this.right),
|
|
47
|
+
width: '40px',
|
|
48
|
+
height: '40px',
|
|
49
|
+
position: 'fixed',
|
|
50
|
+
zIndex: 10,
|
|
51
|
+
}
|
|
52
|
+
return style
|
|
53
|
+
},
|
|
54
|
+
show() {
|
|
55
|
+
return this.$uv.getPx(this.scrollTop) > this.$uv.getPx(this.top)
|
|
56
|
+
},
|
|
57
|
+
contentStyle() {
|
|
58
|
+
const style = {}
|
|
59
|
+
let radius = 0
|
|
60
|
+
// 是否圆形
|
|
61
|
+
if (this.mode === 'circle') {
|
|
62
|
+
radius = '100px'
|
|
63
|
+
} else {
|
|
64
|
+
radius = '4px'
|
|
65
|
+
}
|
|
66
|
+
// 为了兼容安卓nvue,只能这么分开写
|
|
67
|
+
style.borderTopLeftRadius = radius
|
|
68
|
+
style.borderTopRightRadius = radius
|
|
69
|
+
style.borderBottomLeftRadius = radius
|
|
70
|
+
style.borderBottomRightRadius = radius
|
|
71
|
+
return this.$uv.deepMerge(style, this.$uv.addStyle(this.customStyle))
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
methods: {
|
|
75
|
+
backToTop() {
|
|
76
|
+
// #ifdef APP-NVUE
|
|
77
|
+
if (!this.$parent.$refs['uv-back-top']) {
|
|
78
|
+
this.$uv.error(`nvue页面需要给页面最外层元素设置"ref='uv-back-top'`)
|
|
79
|
+
}
|
|
80
|
+
dom.scrollToElement(this.$parent.$refs['uv-back-top'], {
|
|
81
|
+
offset: 0
|
|
82
|
+
})
|
|
83
|
+
// #endif
|
|
84
|
+
|
|
85
|
+
// #ifndef APP-NVUE
|
|
86
|
+
uni.pageScrollTo({
|
|
87
|
+
scrollTop: 0,
|
|
88
|
+
duration: this.duration
|
|
89
|
+
});
|
|
90
|
+
// #endif
|
|
91
|
+
this.$emit('click')
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
</script>
|
|
96
|
+
|
|
97
|
+
<style lang="scss" scoped>
|
|
98
|
+
@import '../../libs/css/components.scss';
|
|
99
|
+
$uv-back-top-flex: 1 !default;
|
|
100
|
+
$uv-back-top-height: 100% !default;
|
|
101
|
+
$uv-back-top-background-color: #E1E1E1 !default;
|
|
102
|
+
$uv-back-top-tips-font-size: 12px !default;
|
|
103
|
+
.uv-back-top {
|
|
104
|
+
@include flex;
|
|
105
|
+
flex-direction: column;
|
|
106
|
+
align-items: center;
|
|
107
|
+
flex: $uv-back-top-flex;
|
|
108
|
+
height: $uv-back-top-height;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
background-color: $uv-back-top-background-color;
|
|
111
|
+
&__tips {
|
|
112
|
+
font-size: $uv-back-top-tips-font-size;
|
|
113
|
+
transform: scale(0.8);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
</style>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 是否显示圆点
|
|
4
|
+
isDot: {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
default: false
|
|
7
|
+
},
|
|
8
|
+
// 显示的内容
|
|
9
|
+
value: {
|
|
10
|
+
type: [Number, String],
|
|
11
|
+
default: ''
|
|
12
|
+
},
|
|
13
|
+
// 是否显示
|
|
14
|
+
show: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: true
|
|
17
|
+
},
|
|
18
|
+
// 最大值,超过最大值会显示 '{max}+'
|
|
19
|
+
max: {
|
|
20
|
+
type: [Number, String],
|
|
21
|
+
default: 999
|
|
22
|
+
},
|
|
23
|
+
// 主题类型,error|warning|success|primary
|
|
24
|
+
type: {
|
|
25
|
+
type: [String,undefined,null],
|
|
26
|
+
default: 'error'
|
|
27
|
+
},
|
|
28
|
+
// 当数值为 0 时,是否展示 Badge
|
|
29
|
+
showZero: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
// 背景颜色,优先级比type高,如设置,type参数会失效
|
|
34
|
+
bgColor: {
|
|
35
|
+
type: [String, null],
|
|
36
|
+
default: null
|
|
37
|
+
},
|
|
38
|
+
// 字体颜色
|
|
39
|
+
color: {
|
|
40
|
+
type: [String, null],
|
|
41
|
+
default: null
|
|
42
|
+
},
|
|
43
|
+
// 徽标形状,circle-四角均为圆角,horn-左下角为直角
|
|
44
|
+
shape: {
|
|
45
|
+
type: [String,undefined,null],
|
|
46
|
+
default: 'circle'
|
|
47
|
+
},
|
|
48
|
+
// 设置数字的显示方式,overflow|ellipsis|limit
|
|
49
|
+
// overflow会根据max字段判断,超出显示`${max}+`
|
|
50
|
+
// ellipsis会根据max判断,超出显示`${max}...`
|
|
51
|
+
// limit会依据1000作为判断条件,超出1000,显示`${value/1000}K`,比如2.2k、3.34w,最多保留2位小数
|
|
52
|
+
numberType: {
|
|
53
|
+
type: [String,undefined,null],
|
|
54
|
+
default: 'overflow'
|
|
55
|
+
},
|
|
56
|
+
// 设置badge的位置偏移,格式为 [x, y],也即设置的为top和right的值,absolute为true时有效
|
|
57
|
+
offset: {
|
|
58
|
+
type: Array,
|
|
59
|
+
default: () => []
|
|
60
|
+
},
|
|
61
|
+
// 是否反转背景和字体颜色
|
|
62
|
+
inverted: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false
|
|
65
|
+
},
|
|
66
|
+
// 是否绝对定位
|
|
67
|
+
absolute: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false
|
|
70
|
+
},
|
|
71
|
+
...uni.$uv?.props?.badge
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<text
|
|
3
|
+
v-if="show && ((Number(value) === 0 ? showZero : true) || isDot)"
|
|
4
|
+
:class="[isDot ? 'uv-badge--dot' : 'uv-badge--not-dot', inverted && 'uv-badge--inverted', shape === 'horn' && 'uv-badge--horn', `uv-badge--${propsType}${inverted ? '--inverted' : ''}`]"
|
|
5
|
+
:style="[$uv.addStyle(customStyle), badgeStyle]"
|
|
6
|
+
class="uv-badge"
|
|
7
|
+
>{{ isDot ? '' :showValue }}</text>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
12
|
+
import mixin from '../../libs/mixin/mixin.js'
|
|
13
|
+
import props from './props.js';
|
|
14
|
+
/**
|
|
15
|
+
* badge 徽标数
|
|
16
|
+
* @description 该组件一般用于图标右上角显示未读的消息数量,提示用户点击,有圆点和圆包含文字两种形式。
|
|
17
|
+
* @tutorial https://www.uvui.cn/components/badge.html
|
|
18
|
+
*
|
|
19
|
+
* @property {Boolean} isDot 是否显示圆点 (默认 false )
|
|
20
|
+
* @property {String | Number} value 显示的内容
|
|
21
|
+
* @property {Boolean} show 是否显示 (默认 true )
|
|
22
|
+
* @property {String | Number} max 最大值,超过最大值会显示 '{max}+' (默认999)
|
|
23
|
+
* @property {String} type 主题类型,error|warning|success|primary (默认 'error' )
|
|
24
|
+
* @property {Boolean} showZero 当数值为 0 时,是否展示 Badge (默认 false )
|
|
25
|
+
* @property {String} bgColor 背景颜色,优先级比type高,如设置,type参数会失效
|
|
26
|
+
* @property {String} color 字体颜色 (默认 '#ffffff' )
|
|
27
|
+
* @property {String} shape 徽标形状,circle-四角均为圆角,horn-左下角为直角 (默认 'circle' )
|
|
28
|
+
* @property {String} numberType 设置数字的显示方式,overflow|ellipsis|limit (默认 'overflow' )
|
|
29
|
+
* @property {Array}} offset 设置badge的位置偏移,格式为 [x, y],也即设置的为top和right的值,absolute为true时有效
|
|
30
|
+
* @property {Boolean} inverted 是否反转背景和字体颜色(默认 false )
|
|
31
|
+
* @property {Boolean} absolute 是否绝对定位(默认 false )
|
|
32
|
+
* @property {Object} customStyle 定义需要用到的外部样式
|
|
33
|
+
* @example <uv-badge :type="type" :count="count"></uv-badge>
|
|
34
|
+
*/
|
|
35
|
+
export default {
|
|
36
|
+
name: 'uv-badge',
|
|
37
|
+
mixins: [mpMixin, mixin, props],
|
|
38
|
+
computed: {
|
|
39
|
+
// 是否将badge中心与父组件右上角重合
|
|
40
|
+
boxStyle() {
|
|
41
|
+
let style = {};
|
|
42
|
+
return style;
|
|
43
|
+
},
|
|
44
|
+
// 整个组件的样式
|
|
45
|
+
badgeStyle() {
|
|
46
|
+
const style = {}
|
|
47
|
+
if(this.color) {
|
|
48
|
+
style.color = this.color
|
|
49
|
+
}
|
|
50
|
+
if (this.bgColor && !this.inverted) {
|
|
51
|
+
style.backgroundColor = this.bgColor
|
|
52
|
+
}
|
|
53
|
+
if (this.absolute) {
|
|
54
|
+
style.position = 'absolute'
|
|
55
|
+
// 如果有设置offset参数
|
|
56
|
+
if(this.offset.length) {
|
|
57
|
+
// top和right分为为offset的第一个和第二个值,如果没有第二个值,则right等于top
|
|
58
|
+
const top = this.offset[0]
|
|
59
|
+
const right = this.offset[1] || top
|
|
60
|
+
style.top = this.$uv.addUnit(top)
|
|
61
|
+
style.right = this.$uv.addUnit(right)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return style
|
|
65
|
+
},
|
|
66
|
+
showValue() {
|
|
67
|
+
switch (this.numberType) {
|
|
68
|
+
case "overflow":
|
|
69
|
+
return Number(this.value) > Number(this.max) ? this.max + "+" : this.value
|
|
70
|
+
break;
|
|
71
|
+
case "ellipsis":
|
|
72
|
+
return Number(this.value) > Number(this.max) ? "..." : this.value
|
|
73
|
+
break;
|
|
74
|
+
case "limit":
|
|
75
|
+
return Number(this.value) > 999 ? Number(this.value) >= 9999 ?
|
|
76
|
+
Math.floor(this.value / 1e4 * 100) / 100 + "w" : Math.floor(this.value /
|
|
77
|
+
1e3 * 100) / 100 + "k" : this.value
|
|
78
|
+
break;
|
|
79
|
+
default:
|
|
80
|
+
return Number(this.value)
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
propsType(){
|
|
84
|
+
return this.type || 'error'
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<style lang="scss" scoped>
|
|
91
|
+
@import '../../libs/css/components.scss';
|
|
92
|
+
@import '../../libs/css/color.scss';
|
|
93
|
+
$uv-badge-primary: $uv-primary !default;
|
|
94
|
+
$uv-badge-error: $uv-error !default;
|
|
95
|
+
$uv-badge-success: $uv-success !default;
|
|
96
|
+
$uv-badge-info: $uv-info !default;
|
|
97
|
+
$uv-badge-warning: $uv-warning !default;
|
|
98
|
+
$uv-badge-dot-radius: 100px !default;
|
|
99
|
+
$uv-badge-dot-size: 8px !default;
|
|
100
|
+
$uv-badge-dot-right: 4px !default;
|
|
101
|
+
$uv-badge-dot-top: 0 !default;
|
|
102
|
+
$uv-badge-text-font-size: 11px !default;
|
|
103
|
+
$uv-badge-text-right: 10px !default;
|
|
104
|
+
$uv-badge-text-padding: 2px 5px !default;
|
|
105
|
+
$uv-badge-text-align: center !default;
|
|
106
|
+
$uv-badge-text-color: #FFFFFF !default;
|
|
107
|
+
|
|
108
|
+
.uv-badge {
|
|
109
|
+
border-top-right-radius: $uv-badge-dot-radius;
|
|
110
|
+
border-top-left-radius: $uv-badge-dot-radius;
|
|
111
|
+
border-bottom-left-radius: $uv-badge-dot-radius;
|
|
112
|
+
border-bottom-right-radius: $uv-badge-dot-radius;
|
|
113
|
+
@include flex;
|
|
114
|
+
line-height: $uv-badge-text-font-size;
|
|
115
|
+
text-align: $uv-badge-text-align;
|
|
116
|
+
font-size: $uv-badge-text-font-size;
|
|
117
|
+
color: $uv-badge-text-color;
|
|
118
|
+
|
|
119
|
+
&--dot {
|
|
120
|
+
height: $uv-badge-dot-size;
|
|
121
|
+
width: $uv-badge-dot-size;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&--inverted {
|
|
125
|
+
font-size: 13px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&--not-dot {
|
|
129
|
+
padding: $uv-badge-text-padding;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&--horn {
|
|
133
|
+
border-bottom-left-radius: 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&--primary {
|
|
137
|
+
background-color: $uv-badge-primary;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&--primary--inverted {
|
|
141
|
+
color: $uv-badge-primary;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&--error {
|
|
145
|
+
background-color: $uv-badge-error;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&--error--inverted {
|
|
149
|
+
color: $uv-badge-error;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&--success {
|
|
153
|
+
background-color: $uv-badge-success;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&--success--inverted {
|
|
157
|
+
color: $uv-badge-success;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&--info {
|
|
161
|
+
background-color: $uv-badge-info;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&--info--inverted {
|
|
165
|
+
color: $uv-badge-info;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
&--warning {
|
|
169
|
+
background-color: $uv-badge-warning;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&--warning--inverted {
|
|
173
|
+
color: $uv-badge-warning;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
$uv-button-active-opacity:0.75 !default;
|
|
2
|
+
$uv-button-loading-text-margin-left:4px !default;
|
|
3
|
+
$uv-button-text-color: #FFFFFF !default;
|
|
4
|
+
$uv-button-text-plain-error-color:$uv-error !default;
|
|
5
|
+
$uv-button-text-plain-warning-color:$uv-warning !default;
|
|
6
|
+
$uv-button-text-plain-success-color:$uv-success !default;
|
|
7
|
+
$uv-button-text-plain-info-color:$uv-info !default;
|
|
8
|
+
$uv-button-text-plain-primary-color:$uv-primary !default;
|
|
9
|
+
.uv-button {
|
|
10
|
+
&--active {
|
|
11
|
+
opacity: $uv-button-active-opacity;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&--active--plain {
|
|
15
|
+
background-color: rgb(217, 217, 217);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&__loading-text {
|
|
19
|
+
margin-left:$uv-button-loading-text-margin-left;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&__text,
|
|
23
|
+
&__loading-text {
|
|
24
|
+
color:$uv-button-text-color;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&__text--plain--error {
|
|
28
|
+
color:$uv-button-text-plain-error-color;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&__text--plain--warning {
|
|
32
|
+
color:$uv-button-text-plain-warning-color;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&__text--plain--success{
|
|
36
|
+
color:$uv-button-text-plain-success-color;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&__text--plain--info {
|
|
40
|
+
color:$uv-button-text-plain-info-color;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&__text--plain--primary {
|
|
44
|
+
color:$uv-button-text-plain-primary-color;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 是否细边框
|
|
4
|
+
hairline: {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
default: true
|
|
7
|
+
},
|
|
8
|
+
// 按钮的预置样式,info,primary,error,warning,success
|
|
9
|
+
type: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: 'info'
|
|
12
|
+
},
|
|
13
|
+
// 按钮尺寸,large,normal,small,mini
|
|
14
|
+
size: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'normal'
|
|
17
|
+
},
|
|
18
|
+
// 按钮形状,circle(两边为半圆),square(带圆角)
|
|
19
|
+
shape: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: 'square'
|
|
22
|
+
},
|
|
23
|
+
// 按钮是否镂空
|
|
24
|
+
plain: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
},
|
|
28
|
+
// 是否禁止状态
|
|
29
|
+
disabled: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
// 是否加载中
|
|
34
|
+
loading: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
// 加载中提示文字
|
|
39
|
+
loadingText: {
|
|
40
|
+
type: [String, Number],
|
|
41
|
+
default: ''
|
|
42
|
+
},
|
|
43
|
+
// 加载状态图标类型
|
|
44
|
+
loadingMode: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: 'spinner'
|
|
47
|
+
},
|
|
48
|
+
// 加载图标大小
|
|
49
|
+
loadingSize: {
|
|
50
|
+
type: [String, Number],
|
|
51
|
+
default: 14
|
|
52
|
+
},
|
|
53
|
+
// 开放能力,具体请看uniapp稳定关于button组件部分说明
|
|
54
|
+
// https://uniapp.dcloud.io/component/button
|
|
55
|
+
openType: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: ''
|
|
58
|
+
},
|
|
59
|
+
// 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件
|
|
60
|
+
// 取值为submit(提交表单),reset(重置表单)
|
|
61
|
+
formType: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: ''
|
|
64
|
+
},
|
|
65
|
+
// 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效
|
|
66
|
+
// 只微信小程序、QQ小程序有效
|
|
67
|
+
appParameter: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: ''
|
|
70
|
+
},
|
|
71
|
+
// 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效
|
|
72
|
+
hoverStopPropagation: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: true
|
|
75
|
+
},
|
|
76
|
+
// 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。只微信小程序有效
|
|
77
|
+
lang: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: 'en'
|
|
80
|
+
},
|
|
81
|
+
// 会话来源,open-type="contact"时有效。只微信小程序有效
|
|
82
|
+
sessionFrom: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: ''
|
|
85
|
+
},
|
|
86
|
+
// 会话内消息卡片标题,open-type="contact"时有效
|
|
87
|
+
// 默认当前标题,只微信小程序有效
|
|
88
|
+
sendMessageTitle: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: ''
|
|
91
|
+
},
|
|
92
|
+
// 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效
|
|
93
|
+
// 默认当前分享路径,只微信小程序有效
|
|
94
|
+
sendMessagePath: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: ''
|
|
97
|
+
},
|
|
98
|
+
// 会话内消息卡片图片,open-type="contact"时有效
|
|
99
|
+
// 默认当前页面截图,只微信小程序有效
|
|
100
|
+
sendMessageImg: {
|
|
101
|
+
type: String,
|
|
102
|
+
default: ''
|
|
103
|
+
},
|
|
104
|
+
// 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,
|
|
105
|
+
// 用户点击后可以快速发送小程序消息,open-type="contact"时有效
|
|
106
|
+
showMessageCard: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: true
|
|
109
|
+
},
|
|
110
|
+
// 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取
|
|
111
|
+
dataName: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: ''
|
|
114
|
+
},
|
|
115
|
+
// 节流,一定时间内只能触发一次
|
|
116
|
+
throttleTime: {
|
|
117
|
+
type: [String, Number],
|
|
118
|
+
default: 0
|
|
119
|
+
},
|
|
120
|
+
// 按住后多久出现点击态,单位毫秒
|
|
121
|
+
hoverStartTime: {
|
|
122
|
+
type: [String, Number],
|
|
123
|
+
default: 0
|
|
124
|
+
},
|
|
125
|
+
// 手指松开后点击态保留时间,单位毫秒
|
|
126
|
+
hoverStayTime: {
|
|
127
|
+
type: [String, Number],
|
|
128
|
+
default: 200
|
|
129
|
+
},
|
|
130
|
+
// 按钮文字,之所以通过props传入,是因为slot传入的话
|
|
131
|
+
// nvue中无法控制文字的样式
|
|
132
|
+
text: {
|
|
133
|
+
type: [String, Number],
|
|
134
|
+
default: ''
|
|
135
|
+
},
|
|
136
|
+
// 按钮图标
|
|
137
|
+
icon: {
|
|
138
|
+
type: String,
|
|
139
|
+
default: ''
|
|
140
|
+
},
|
|
141
|
+
// 按钮图标大小
|
|
142
|
+
iconSize: {
|
|
143
|
+
type: [String, Number],
|
|
144
|
+
default: ''
|
|
145
|
+
},
|
|
146
|
+
// 按钮图标颜色
|
|
147
|
+
iconColor: {
|
|
148
|
+
type: String,
|
|
149
|
+
default: '#000000'
|
|
150
|
+
},
|
|
151
|
+
// 按钮颜色,支持传入linear-gradient渐变色
|
|
152
|
+
color: {
|
|
153
|
+
type: String,
|
|
154
|
+
default: ''
|
|
155
|
+
},
|
|
156
|
+
// 自定义按钮文本样式
|
|
157
|
+
customTextStyle: {
|
|
158
|
+
type: [Object,String],
|
|
159
|
+
default: ''
|
|
160
|
+
},
|
|
161
|
+
...uni.$uv?.props?.button
|
|
162
|
+
}
|
|
163
|
+
}
|