@zfqh/uniapp 0.1.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.
- package/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +39 -0
- package/docs/api/apis/core.md +189 -0
- package/docs/api/apis/index.md +82 -0
- package/docs/api/apis/request.md +369 -0
- package/docs/api/configs/api.md +32 -0
- package/docs/api/configs/app.md +43 -0
- package/docs/api/configs/brand.md +43 -0
- package/docs/api/configs/cdn.md +35 -0
- package/docs/api/configs/color.md +144 -0
- package/docs/api/configs/env.md +120 -0
- package/docs/api/configs/index.md +394 -0
- package/docs/api/configs/link.md +33 -0
- package/docs/api/configs/log.md +27 -0
- package/docs/api/configs/mp.md +34 -0
- package/docs/api/configs/navigate.md +27 -0
- package/docs/api/configs/page.md +32 -0
- package/docs/api/configs/path.md +27 -0
- package/docs/api/configs/storage.md +24 -0
- package/docs/api/configs/tabbar.md +29 -0
- package/docs/api/configs/toast.md +35 -0
- package/docs/api/configs/update.md +25 -0
- package/docs/api/configs/upload.md +45 -0
- package/docs/api/configs/ver.md +32 -0
- package/docs/api/configs/web.md +28 -0
- package/docs/api/hooks/index.md +182 -0
- package/docs/api/hooks/useI18n.md +27 -0
- package/docs/api/hooks/useOverlay.md +37 -0
- package/docs/api/hooks/usePopup.md +35 -0
- package/docs/api/hooks/useVersion.md +23 -0
- package/docs/api/index.md +269 -0
- package/docs/api/mixins/app.md +29 -0
- package/docs/api/mixins/badge.md +23 -0
- package/docs/api/mixins/debounce.md +32 -0
- package/docs/api/mixins/deep.md +29 -0
- package/docs/api/mixins/index.md +23 -0
- package/docs/api/mixins/login.md +22 -0
- package/docs/api/mixins/model.md +26 -0
- package/docs/api/mixins/redirect.md +26 -0
- package/docs/api/mixins/share.md +29 -0
- package/docs/api/mixins/show.md +27 -0
- package/docs/api/mixins/webview.md +27 -0
- package/docs/api/modules/app.md +30 -0
- package/docs/api/modules/dict.md +28 -0
- package/docs/api/modules/im.md +22 -0
- package/docs/api/modules/index.md +44 -0
- package/docs/api/modules/launch.md +26 -0
- package/docs/api/modules/location.md +25 -0
- package/docs/api/modules/login.md +35 -0
- package/docs/api/modules/network.md +26 -0
- package/docs/api/modules/system.md +29 -0
- package/docs/api/utils/audio.md +84 -0
- package/docs/api/utils/consts.md +201 -0
- package/docs/api/utils/cos.md +269 -0
- package/docs/api/utils/debounce.md +89 -0
- package/docs/api/utils/file.md +78 -0
- package/docs/api/utils/index.md +547 -0
- package/docs/api/utils/locale.md +32 -0
- package/docs/api/utils/message.md +81 -0
- package/docs/api/utils/navigate.md +267 -0
- package/docs/api/utils/pages.md +205 -0
- package/docs/api/utils/permission.md +28 -0
- package/docs/api/utils/permit.md +62 -0
- package/docs/api/utils/query.md +89 -0
- package/docs/api/utils/request.md +34 -0
- package/docs/api/utils/storage.md +145 -0
- package/docs/api/utils/subscribe.md +77 -0
- package/docs/api/utils/throttle.md +101 -0
- package/docs/api/utils/toast.md +164 -0
- package/docs/api/utils/uni.md +28 -0
- package/docs/api/utils/update.md +165 -0
- package/docs/components/g-back-button.md +76 -0
- package/docs/components/g-checkbox-list.md +101 -0
- package/docs/components/g-container.md +93 -0
- package/docs/components/g-data-list.md +106 -0
- package/docs/components/g-dot-text.md +79 -0
- package/docs/components/g-env.md +75 -0
- package/docs/components/g-float.md +83 -0
- package/docs/components/g-grid-image.md +91 -0
- package/docs/components/g-grid-swiper.md +99 -0
- package/docs/components/g-icon.md +106 -0
- package/docs/components/g-mask.md +82 -0
- package/docs/components/g-money.md +90 -0
- package/docs/components/g-more.md +78 -0
- package/docs/components/g-page-container.md +170 -0
- package/docs/components/g-permission-popup.md +117 -0
- package/docs/components/g-polyline-chat.md +102 -0
- package/docs/components/g-polyline-view.md +67 -0
- package/docs/components/g-popup.md +144 -0
- package/docs/components/g-refresh-view.md +118 -0
- package/docs/components/g-render-image.md +83 -0
- package/docs/components/g-search.md +120 -0
- package/docs/components/g-share-photo.md +77 -0
- package/docs/components/g-share-view.md +83 -0
- package/docs/components/g-share-weixin.md +81 -0
- package/docs/components/g-skeleton-view.md +71 -0
- package/docs/components/g-skeleton.md +64 -0
- package/docs/components/g-tag-editor.md +134 -0
- package/docs/components/g-timer.md +72 -0
- package/docs/components/g-trtc-room.md +116 -0
- package/docs/components/g-trtc-tui.md +84 -0
- package/docs/components/g-trtc.md +124 -0
- package/docs/components/g-upload.md +117 -0
- package/docs/components/g-waterfall.md +84 -0
- package/docs/components/index.md +109 -0
- package/docs/components/styles/base-styles.md +367 -0
- package/docs/components/styles/global-vars.md +150 -0
- package/docs/components/usage.md +112 -0
- package/docs/faq/index.md +78 -0
- package/docs/guide/getting-started.md +195 -0
- package/docs/guide/project-frame.md +297 -0
- package/docs/index.md +80 -0
- package/lib/apis/core.d.ts +12 -0
- package/lib/apis/core.js +13 -0
- package/lib/apis/index.d.ts +2 -0
- package/lib/apis/index.js +2 -0
- package/lib/apis/request.d.ts +4 -0
- package/lib/apis/request.js +27 -0
- package/lib/components/g-back-button/g-back-button.vue +141 -0
- package/lib/components/g-checkbox-list/g-checkbox-list.vue +156 -0
- package/lib/components/g-container/g-container.vue +159 -0
- package/lib/components/g-data-list/g-data-list.vue +192 -0
- package/lib/components/g-dot-text/g-dot-text.vue +114 -0
- package/lib/components/g-env/g-env.vue +123 -0
- package/lib/components/g-float/g-float.vue +131 -0
- package/lib/components/g-grid-image/g-grid-image.vue +84 -0
- package/lib/components/g-grid-swiper/g-grid-swiper.vue +224 -0
- package/lib/components/g-icon/g-icon.vue +72 -0
- package/lib/components/g-mask/g-mask.vue +126 -0
- package/lib/components/g-money/g-money.vue +174 -0
- package/lib/components/g-more/g-more.vue +68 -0
- package/lib/components/g-page-container/g-page-container.vue +470 -0
- package/lib/components/g-permission-popup/g-permission-popup.vue +80 -0
- package/lib/components/g-polyline-chat/g-polyline-chat.vue +255 -0
- package/lib/components/g-polyline-view/g-polyline-view.vue +104 -0
- package/lib/components/g-popup/g-popup.vue +449 -0
- package/lib/components/g-refresh-view/g-refresh-view.vue +213 -0
- package/lib/components/g-render-image/g-render-image.vue +222 -0
- package/lib/components/g-search/g-search.vue +274 -0
- package/lib/components/g-share-photo/g-share-photo.vue +75 -0
- package/lib/components/g-share-view/g-share-view.vue +157 -0
- package/lib/components/g-share-weixin/g-share-weixin.vue +106 -0
- package/lib/components/g-skeleton/g-skeleton.vue +55 -0
- package/lib/components/g-skeleton-view/g-skeleton-view.vue +78 -0
- package/lib/components/g-tag-editor/g-tag-editor.vue +482 -0
- package/lib/components/g-timer/g-timer.vue +61 -0
- package/lib/components/g-trtc/g-trtc.vue +347 -0
- package/lib/components/g-trtc-room/g-trtc-room.vue +524 -0
- package/lib/components/g-trtc-room/iconfont.scss +59 -0
- package/lib/components/g-trtc-tui/g-trtc-tui.vue +245 -0
- package/lib/components/g-upload/g-upload.vue +294 -0
- package/lib/components/g-waterfall/g-waterfall.vue +101 -0
- package/lib/configs/api.d.ts +7 -0
- package/lib/configs/api.js +6 -0
- package/lib/configs/app.d.ts +26 -0
- package/lib/configs/app.js +50 -0
- package/lib/configs/brand.d.ts +22 -0
- package/lib/configs/brand.js +26 -0
- package/lib/configs/cdn.d.ts +13 -0
- package/lib/configs/cdn.js +12 -0
- package/lib/configs/color.d.ts +62 -0
- package/lib/configs/color.js +66 -0
- package/lib/configs/env.d.ts +37 -0
- package/lib/configs/env.js +71 -0
- package/lib/configs/index.d.ts +170 -0
- package/lib/configs/index.js +82 -0
- package/lib/configs/link.d.ts +11 -0
- package/lib/configs/link.js +3 -0
- package/lib/configs/log.d.ts +9 -0
- package/lib/configs/log.js +8 -0
- package/lib/configs/mp.d.ts +15 -0
- package/lib/configs/mp.js +9 -0
- package/lib/configs/navigate.d.ts +17 -0
- package/lib/configs/navigate.js +5 -0
- package/lib/configs/page.d.ts +18 -0
- package/lib/configs/page.js +14 -0
- package/lib/configs/path.d.ts +11 -0
- package/lib/configs/path.js +10 -0
- package/lib/configs/storage.d.ts +7 -0
- package/lib/configs/storage.js +6 -0
- package/lib/configs/tabbar.d.ts +7 -0
- package/lib/configs/tabbar.js +6 -0
- package/lib/configs/toast.d.ts +18 -0
- package/lib/configs/toast.js +29 -0
- package/lib/configs/update.d.ts +45 -0
- package/lib/configs/update.js +6 -0
- package/lib/configs/upload.d.ts +30 -0
- package/lib/configs/upload.js +7 -0
- package/lib/configs/ver.d.ts +8 -0
- package/lib/configs/ver.js +28 -0
- package/lib/configs/web.d.ts +5 -0
- package/lib/configs/web.js +2 -0
- package/lib/hooks/index.d.ts +4 -0
- package/lib/hooks/index.js +4 -0
- package/lib/hooks/useI18n.d.ts +2 -0
- package/lib/hooks/useI18n.js +19 -0
- package/lib/hooks/useOverlay.d.ts +1 -0
- package/lib/hooks/useOverlay.js +17 -0
- package/lib/hooks/usePopup.d.ts +1 -0
- package/lib/hooks/usePopup.js +14 -0
- package/lib/hooks/useVersion.d.ts +6 -0
- package/lib/hooks/useVersion.js +21 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.js +33 -0
- package/lib/mixins/app.d.ts +14 -0
- package/lib/mixins/app.js +105 -0
- package/lib/mixins/badge.d.ts +24 -0
- package/lib/mixins/badge.js +44 -0
- package/lib/mixins/debounce.d.ts +6 -0
- package/lib/mixins/debounce.js +11 -0
- package/lib/mixins/deep.d.ts +6 -0
- package/lib/mixins/deep.js +8 -0
- package/lib/mixins/index.d.ts +8 -0
- package/lib/mixins/index.js +8 -0
- package/lib/mixins/login.d.ts +4 -0
- package/lib/mixins/login.js +25 -0
- package/lib/mixins/model.d.ts +22 -0
- package/lib/mixins/model.js +29 -0
- package/lib/mixins/redirect.d.ts +8 -0
- package/lib/mixins/redirect.js +94 -0
- package/lib/mixins/share.d.ts +15 -0
- package/lib/mixins/share.js +55 -0
- package/lib/mixins/show.d.ts +9 -0
- package/lib/mixins/show.js +16 -0
- package/lib/mixins/webview.d.ts +26 -0
- package/lib/mixins/webview.js +225 -0
- package/lib/modules/app.d.ts +5 -0
- package/lib/modules/app.js +19 -0
- package/lib/modules/dict.d.ts +8 -0
- package/lib/modules/dict.js +43 -0
- package/lib/modules/im.d.ts +6 -0
- package/lib/modules/im.js +105 -0
- package/lib/modules/index.d.ts +8 -0
- package/lib/modules/index.js +8 -0
- package/lib/modules/launch.d.ts +5 -0
- package/lib/modules/launch.js +32 -0
- package/lib/modules/location.d.ts +5 -0
- package/lib/modules/location.js +57 -0
- package/lib/modules/login.d.ts +5 -0
- package/lib/modules/login.js +72 -0
- package/lib/modules/network.d.ts +5 -0
- package/lib/modules/network.js +39 -0
- package/lib/modules/system.d.ts +5 -0
- package/lib/modules/system.js +65 -0
- package/lib/styles/animate-vue.scss +3 -0
- package/lib/styles/animate.scss +27 -0
- package/lib/styles/bg-vue.scss +21 -0
- package/lib/styles/bg.scss +93 -0
- package/lib/styles/border.scss +218 -0
- package/lib/styles/flex-nvue.scss +64 -0
- package/lib/styles/flex-vue.scss +75 -0
- package/lib/styles/font.scss +59 -0
- package/lib/styles/index.scss +25 -0
- package/lib/styles/layout-nvue.scss +24 -0
- package/lib/styles/layout-vue.scss +30 -0
- package/lib/styles/layout.scss +76 -0
- package/lib/styles/opacity.scss +10 -0
- package/lib/styles/reset-vue.scss +46 -0
- package/lib/styles/shadow.scss +12 -0
- package/lib/styles/sizing-vue.scss +21 -0
- package/lib/styles/sizing.scss +21 -0
- package/lib/styles/spacing.scss +234 -0
- package/lib/styles/text-nvue.scss +21 -0
- package/lib/styles/text-vue.scss +70 -0
- package/lib/styles/text.scss +122 -0
- package/lib/styles/var.module.scss +29 -0
- package/lib/utils/audio.d.ts +14 -0
- package/lib/utils/audio.js +43 -0
- package/lib/utils/consts.d.ts +30 -0
- package/lib/utils/consts.js +52 -0
- package/lib/utils/cos.d.ts +15 -0
- package/lib/utils/cos.js +140 -0
- package/lib/utils/debounce.d.ts +2 -0
- package/lib/utils/debounce.js +30 -0
- package/lib/utils/file.d.ts +28 -0
- package/lib/utils/file.js +292 -0
- package/lib/utils/index.d.ts +166 -0
- package/lib/utils/index.js +485 -0
- package/lib/utils/locale.d.ts +6 -0
- package/lib/utils/locale.js +19 -0
- package/lib/utils/message.d.ts +9 -0
- package/lib/utils/message.js +63 -0
- package/lib/utils/navigate.d.ts +27 -0
- package/lib/utils/navigate.js +183 -0
- package/lib/utils/pages.d.ts +21 -0
- package/lib/utils/pages.js +79 -0
- package/lib/utils/permission.d.ts +16 -0
- package/lib/utils/permission.js +291 -0
- package/lib/utils/permit.d.ts +30 -0
- package/lib/utils/permit.js +181 -0
- package/lib/utils/query.d.ts +13 -0
- package/lib/utils/query.js +14 -0
- package/lib/utils/request.d.ts +8 -0
- package/lib/utils/request.js +126 -0
- package/lib/utils/storage.d.ts +53 -0
- package/lib/utils/storage.js +145 -0
- package/lib/utils/subscribe.d.ts +7 -0
- package/lib/utils/subscribe.js +94 -0
- package/lib/utils/throttle.d.ts +2 -0
- package/lib/utils/throttle.js +32 -0
- package/lib/utils/toast.d.ts +17 -0
- package/lib/utils/toast.js +66 -0
- package/lib/utils/uni.d.ts +1 -0
- package/lib/utils/uni.js +147 -0
- package/lib/utils/update.d.ts +9 -0
- package/lib/utils/update.js +376 -0
- package/package.json +49 -0
- package/types/index.d.ts +25 -0
- package/types/virtual.d.ts +1 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="mask"
|
|
4
|
+
hover-stop-propagation
|
|
5
|
+
:style="[maskStyle, zoomStyle]"
|
|
6
|
+
@tap="click"
|
|
7
|
+
@touchmove.stop.prevent="() => {}"
|
|
8
|
+
:class="{
|
|
9
|
+
'mask-zoom': zoom,
|
|
10
|
+
'mask-show': show,
|
|
11
|
+
}"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
</view>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
/**
|
|
19
|
+
* mask 遮罩
|
|
20
|
+
* @description 创建一个遮罩层,用于强调特定的页面元素,并阻止用户对遮罩下层的内容进行操作,一般用于弹窗场景
|
|
21
|
+
* @property {Boolean} show 是否显示遮罩(默认false)
|
|
22
|
+
* @property {String Number} z-index z-index 层级(默认1070)
|
|
23
|
+
* @property {Object} custom-style 自定义样式对象,见上方说明
|
|
24
|
+
* @property {String Number} duration 动画时长,单位毫秒(默认300)
|
|
25
|
+
* @property {Boolean} zoom 是否使用scale对遮罩进行缩放(默认true)
|
|
26
|
+
* @property {Boolean} mask-click-able 遮罩是否可点击,为false时点击不会发送click事件(默认true)
|
|
27
|
+
* @event {Function} click mask-click-able为true时,点击遮罩发送此事件
|
|
28
|
+
* @example <g-mask :show="show" @click="show = false"></g-mask>
|
|
29
|
+
*/
|
|
30
|
+
export default {
|
|
31
|
+
name: 'g-mask',
|
|
32
|
+
props: {
|
|
33
|
+
// 是否显示遮罩
|
|
34
|
+
show: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false,
|
|
37
|
+
},
|
|
38
|
+
// 层级z-index
|
|
39
|
+
zIndex: {
|
|
40
|
+
type: [Number, String],
|
|
41
|
+
default: '',
|
|
42
|
+
},
|
|
43
|
+
// 用户自定义样式
|
|
44
|
+
customStyle: {
|
|
45
|
+
type: Object,
|
|
46
|
+
default() {
|
|
47
|
+
return {};
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
// 遮罩的动画样式, 是否使用使用zoom进行scale进行缩放
|
|
51
|
+
zoom: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: true,
|
|
54
|
+
},
|
|
55
|
+
// 遮罩的过渡时间,单位为ms
|
|
56
|
+
duration: {
|
|
57
|
+
type: [Number, String],
|
|
58
|
+
default: 300,
|
|
59
|
+
},
|
|
60
|
+
// 是否可以通过点击遮罩进行关闭
|
|
61
|
+
maskClickAble: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: true,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
data() {
|
|
67
|
+
return {
|
|
68
|
+
zoomStyle: {
|
|
69
|
+
transform: 'scale(1, 1)',
|
|
70
|
+
},
|
|
71
|
+
scale: 'scale(1.2, 1.2)',
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
watch: {
|
|
75
|
+
show(n) {
|
|
76
|
+
if (n && this.zoom) {
|
|
77
|
+
// 当展示遮罩的时候,设置scale为1,达到缩小(原来为1.2)的效果
|
|
78
|
+
this.zoomStyle.transform = 'scale(1, 1)';
|
|
79
|
+
} else if (!n && this.zoom) {
|
|
80
|
+
// 当隐藏遮罩的时候,设置scale为1.2,达到放大(因为显示遮罩时已重置为1)的效果
|
|
81
|
+
this.zoomStyle.transform = this.scale;
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
computed: {
|
|
86
|
+
maskStyle() {
|
|
87
|
+
let style = {};
|
|
88
|
+
style.backgroundColor = 'rgba(0, 0, 0, 0.6)';
|
|
89
|
+
if (this.show) style.zIndex = this.zIndex ? this.zIndex : 10000;
|
|
90
|
+
else style.zIndex = -1;
|
|
91
|
+
style.transition = `all ${this.duration / 1000}s ease-in-out`;
|
|
92
|
+
// 判断用户传递的对象是否为空,不为空就进行合并
|
|
93
|
+
if (Object.keys(this.customStyle).length)
|
|
94
|
+
style = {
|
|
95
|
+
...style,
|
|
96
|
+
...this.customStyle,
|
|
97
|
+
};
|
|
98
|
+
return style;
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
methods: {
|
|
102
|
+
click() {
|
|
103
|
+
if (!this.maskClickAble) return;
|
|
104
|
+
this.$emit('click');
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<style lang="scss" scoped>
|
|
111
|
+
.mask {
|
|
112
|
+
position: fixed;
|
|
113
|
+
top: 0;
|
|
114
|
+
left: 0;
|
|
115
|
+
right: 0;
|
|
116
|
+
bottom: 0;
|
|
117
|
+
opacity: 0;
|
|
118
|
+
transition: transform 0.3s;
|
|
119
|
+
}
|
|
120
|
+
.mask-show {
|
|
121
|
+
opacity: 1;
|
|
122
|
+
}
|
|
123
|
+
.mask-zoom {
|
|
124
|
+
transform: scale(1.2, 1.2);
|
|
125
|
+
}
|
|
126
|
+
</style>
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="flex" :class="[{ 'items-start': align === 'top', 'items-end': align === 'bottom', 'items-center': align === 'center', 'items-stretch': align === 'stretch', 'items-baseline': align === 'baseline' }]" :style="[customStyle]">
|
|
3
|
+
<view v-if="prefix" :style="[_signStyle]">
|
|
4
|
+
<slot name="prefix">
|
|
5
|
+
<text :style="[prefixStyle]"> {{ prefix }} </text>
|
|
6
|
+
</slot>
|
|
7
|
+
</view>
|
|
8
|
+
<slot name="value">
|
|
9
|
+
<text v-if="sign" :style="[_signStyle]"> {{ sign }} </text>
|
|
10
|
+
<text :style="[_valueStyle, fontStyle]"> {{ valueStart }} </text>
|
|
11
|
+
<text v-if="valueEnd" :style="[_decimalStyle, fontStyle]"> {{ valueEnd }} </text>
|
|
12
|
+
</slot>
|
|
13
|
+
<view v-if="suffix" :style="[_decimalStyle]">
|
|
14
|
+
<slot name="suffix">
|
|
15
|
+
<text :style="[suffixStyle]"> {{ suffix }} </text>
|
|
16
|
+
</slot>
|
|
17
|
+
</view>
|
|
18
|
+
</view>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
export default {
|
|
23
|
+
props: {
|
|
24
|
+
// 金额值
|
|
25
|
+
value: {
|
|
26
|
+
type: [String, Number],
|
|
27
|
+
default: 0,
|
|
28
|
+
},
|
|
29
|
+
// 金额符号
|
|
30
|
+
sign: {
|
|
31
|
+
type: [String, Boolean],
|
|
32
|
+
default: '¥',
|
|
33
|
+
},
|
|
34
|
+
// 金额前缀
|
|
35
|
+
prefix: {
|
|
36
|
+
type: [String, Boolean],
|
|
37
|
+
default: false,
|
|
38
|
+
},
|
|
39
|
+
// 金额后缀
|
|
40
|
+
suffix: {
|
|
41
|
+
type: [String, Boolean],
|
|
42
|
+
default: false,
|
|
43
|
+
},
|
|
44
|
+
// 是否显示小数点
|
|
45
|
+
decimal: {
|
|
46
|
+
type: [Boolean, String, Number],
|
|
47
|
+
default: 2,
|
|
48
|
+
},
|
|
49
|
+
// 金额字体大小
|
|
50
|
+
size: {
|
|
51
|
+
type: [String, Number],
|
|
52
|
+
default: 20,
|
|
53
|
+
},
|
|
54
|
+
// 金额符号字体大小
|
|
55
|
+
signSize: {
|
|
56
|
+
type: [String, Number],
|
|
57
|
+
default: 12,
|
|
58
|
+
},
|
|
59
|
+
// 金额小数字体大小
|
|
60
|
+
decimalSize: {
|
|
61
|
+
type: [String, Number],
|
|
62
|
+
default: 12,
|
|
63
|
+
},
|
|
64
|
+
// 金额字符对齐方式
|
|
65
|
+
align: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: 'baseline',
|
|
68
|
+
},
|
|
69
|
+
customStyle: {
|
|
70
|
+
type: Object,
|
|
71
|
+
default: () => ({}),
|
|
72
|
+
},
|
|
73
|
+
signStyle: {
|
|
74
|
+
type: Object,
|
|
75
|
+
default: () => ({}),
|
|
76
|
+
},
|
|
77
|
+
valueStyle: {
|
|
78
|
+
type: Object,
|
|
79
|
+
default: () => ({}),
|
|
80
|
+
},
|
|
81
|
+
decimalStyle: {
|
|
82
|
+
type: Object,
|
|
83
|
+
default: () => ({}),
|
|
84
|
+
},
|
|
85
|
+
prefixStyle: {
|
|
86
|
+
type: Object,
|
|
87
|
+
default: () => ({}),
|
|
88
|
+
},
|
|
89
|
+
suffixStyle: {
|
|
90
|
+
type: Object,
|
|
91
|
+
default: () => ({}),
|
|
92
|
+
},
|
|
93
|
+
font: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: 'rubik-medium',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
computed: {
|
|
99
|
+
fontStyle() {
|
|
100
|
+
return { fontFamily: this.font };
|
|
101
|
+
},
|
|
102
|
+
_valueStyle() {
|
|
103
|
+
const fontSize = uni.$uv.addUnit(this.size);
|
|
104
|
+
return Object.assign(
|
|
105
|
+
{
|
|
106
|
+
fontSize,
|
|
107
|
+
lineHeight: fontSize,
|
|
108
|
+
},
|
|
109
|
+
this.valueStyle,
|
|
110
|
+
);
|
|
111
|
+
},
|
|
112
|
+
_signStyle() {
|
|
113
|
+
const fontSize = uni.$uv.addUnit(this.signSize);
|
|
114
|
+
return Object.assign(
|
|
115
|
+
{
|
|
116
|
+
fontSize,
|
|
117
|
+
lineHeight: this.getLineHeight(this.signSize, this.size),
|
|
118
|
+
},
|
|
119
|
+
this.signStyle,
|
|
120
|
+
);
|
|
121
|
+
},
|
|
122
|
+
_decimalStyle() {
|
|
123
|
+
const fontSize = uni.$uv.addUnit(this.decimalSize);
|
|
124
|
+
return Object.assign(
|
|
125
|
+
{
|
|
126
|
+
fontSize,
|
|
127
|
+
lineHeight: this.getLineHeight(this.decimalSize, this.size),
|
|
128
|
+
},
|
|
129
|
+
this.decimalStyle,
|
|
130
|
+
);
|
|
131
|
+
},
|
|
132
|
+
valueStart() {
|
|
133
|
+
const number = Number.parseInt(this.value);
|
|
134
|
+
if (isNaN(number)) {
|
|
135
|
+
return 0;
|
|
136
|
+
}
|
|
137
|
+
return number;
|
|
138
|
+
},
|
|
139
|
+
valueEnd() {
|
|
140
|
+
const { value, decimal } = this;
|
|
141
|
+
if (decimal !== false) {
|
|
142
|
+
let number = Number.parseFloat(value);
|
|
143
|
+
if (isNaN(number)) {
|
|
144
|
+
number = 0;
|
|
145
|
+
}
|
|
146
|
+
if (decimal === 'auto') {
|
|
147
|
+
let [, end = ''] = String(number).split('.');
|
|
148
|
+
end = end.replace(/0+$/, '');
|
|
149
|
+
if (end) {
|
|
150
|
+
return '.' + end;
|
|
151
|
+
}
|
|
152
|
+
} else if (decimal === true || typeof decimal === 'number') {
|
|
153
|
+
const [, end] = number.toFixed(decimal === true ? 2 : decimal).split('.');
|
|
154
|
+
return '.' + end;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return '';
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
methods: {
|
|
161
|
+
getLineHeight(selfSize = 0, size = 0) {
|
|
162
|
+
selfSize = parseFloat(selfSize);
|
|
163
|
+
size = parseFloat(size);
|
|
164
|
+
let lineHeight = size;
|
|
165
|
+
if (selfSize < size) {
|
|
166
|
+
lineHeight = selfSize + (size - selfSize) / 2;
|
|
167
|
+
}
|
|
168
|
+
return uni.$uv.addUnit(lineHeight);
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
</script>
|
|
173
|
+
|
|
174
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :style="[style]">
|
|
3
|
+
<view class="flex" @tap.stop="click">
|
|
4
|
+
<slot name="text">
|
|
5
|
+
<text> {{ text }} </text>
|
|
6
|
+
</slot>
|
|
7
|
+
<slot name="arrow">
|
|
8
|
+
<g-icon :name="iconName" :size="iconSize" class="flex" />
|
|
9
|
+
</slot>
|
|
10
|
+
</view>
|
|
11
|
+
</view>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
import color from '../../configs/color';
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
props: {
|
|
19
|
+
text: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: '更多',
|
|
22
|
+
},
|
|
23
|
+
textSize: {
|
|
24
|
+
type: [String, Number],
|
|
25
|
+
default: 13,
|
|
26
|
+
},
|
|
27
|
+
iconName: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: 'arrow-right',
|
|
30
|
+
},
|
|
31
|
+
iconSize: {
|
|
32
|
+
type: [String, Number],
|
|
33
|
+
default: 10,
|
|
34
|
+
},
|
|
35
|
+
color: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: () => color.tipsColor,
|
|
38
|
+
},
|
|
39
|
+
marginTop: {
|
|
40
|
+
type: [String, Number],
|
|
41
|
+
default: 0,
|
|
42
|
+
},
|
|
43
|
+
customStyle: {
|
|
44
|
+
type: Object,
|
|
45
|
+
default: () => ({}),
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
computed: {
|
|
49
|
+
style() {
|
|
50
|
+
return Object.assign(
|
|
51
|
+
{
|
|
52
|
+
marginTop: uni.$uv.addUnit(this.marginTop),
|
|
53
|
+
fontSize: uni.$uv.addUnit(this.textSize),
|
|
54
|
+
color: this.color,
|
|
55
|
+
},
|
|
56
|
+
this.customStyle,
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
methods: {
|
|
61
|
+
click(e) {
|
|
62
|
+
this.$emit('click', e);
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<style></style>
|