1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
| "use strict";
| const common_vendor = require("../../../../common/vendor.js");
| const _sfc_main = {
| name: "UniBadge",
| emits: ["click"],
| props: {
| type: {
| type: String,
| default: "error"
| },
| inverted: {
| type: Boolean,
| default: false
| },
| isDot: {
| type: Boolean,
| default: false
| },
| maxNum: {
| type: Number,
| default: 99
| },
| absolute: {
| type: String,
| default: ""
| },
| offset: {
| type: Array,
| default() {
| return [0, 0];
| }
| },
| text: {
| type: [String, Number],
| default: ""
| },
| size: {
| type: String,
| default: "small"
| },
| customStyle: {
| type: Object,
| default() {
| return {};
| }
| }
| },
| data() {
| return {};
| },
| computed: {
| width() {
| return String(this.text).length * 8 + 12;
| },
| classNames() {
| const {
| inverted,
| type,
| size,
| absolute
| } = this;
| return [
| inverted ? "uni-badge--" + type + "-inverted" : "",
| "uni-badge--" + type,
| "uni-badge--" + size,
| absolute ? "uni-badge--absolute" : ""
| ].join(" ");
| },
| positionStyle() {
| if (!this.absolute)
| return {};
| let w = this.width / 2, h = 10;
| if (this.isDot) {
| w = 5;
| h = 5;
| }
| const x = `${-w + this.offset[0]}px`;
| const y = `${-h + this.offset[1]}px`;
| const whiteList = {
| rightTop: {
| right: x,
| top: y
| },
| rightBottom: {
| right: x,
| bottom: y
| },
| leftBottom: {
| left: x,
| bottom: y
| },
| leftTop: {
| left: x,
| top: y
| }
| };
| const match = whiteList[this.absolute];
| return match ? match : whiteList["rightTop"];
| },
| dotStyle() {
| if (!this.isDot)
| return {};
| return {
| width: "10px",
| minWidth: "0",
| height: "10px",
| padding: "0",
| borderRadius: "10px"
| };
| },
| displayValue() {
| const {
| isDot,
| text,
| maxNum
| } = this;
| return isDot ? "" : Number(text) > maxNum ? `${maxNum}+` : text;
| }
| },
| methods: {
| onClick() {
| this.$emit("click");
| }
| }
| };
| function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
| return common_vendor.e({
| a: $props.text
| }, $props.text ? {
| b: common_vendor.t($options.displayValue),
| c: common_vendor.n($options.classNames),
| d: common_vendor.s($options.positionStyle),
| e: common_vendor.s($props.customStyle),
| f: common_vendor.s($options.dotStyle),
| g: common_vendor.o(($event) => $options.onClick())
| } : {});
| }
| const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
| wx.createComponent(Component);
| //# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/uni-badge/components/uni-badge/uni-badge.js.map
|
|