调整微信小程序的报错。
This commit is contained in:
140
unpackage/dist/dev/mp-weixin/uni_modules/uni-badge/components/uni-badge/uni-badge.js
vendored
Normal file
140
unpackage/dist/dev/mp-weixin/uni_modules/uni-badge/components/uni-badge/uni-badge.js
vendored
Normal file
@@ -0,0 +1,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
|
||||
4
unpackage/dist/dev/mp-weixin/uni_modules/uni-badge/components/uni-badge/uni-badge.json
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/uni_modules/uni-badge/components/uni-badge/uni-badge.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/uni-badge/components/uni-badge/uni-badge.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/uni-badge/components/uni-badge/uni-badge.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="uni-badge--x"><slot/><text wx:if="{{a}}" class="{{[c, 'uni-badge']}}" style="{{d + ';' + e + ';' + f}}" bindtap="{{g}}">{{b}}</text></view>
|
||||
96
unpackage/dist/dev/mp-weixin/uni_modules/uni-badge/components/uni-badge/uni-badge.wxss
vendored
Normal file
96
unpackage/dist/dev/mp-weixin/uni_modules/uni-badge/components/uni-badge/uni-badge.wxss
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.uni-badge--x {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
.uni-badge--absolute {
|
||||
position: absolute;
|
||||
}
|
||||
.uni-badge--small {
|
||||
transform: scale(0.8);
|
||||
transform-origin: center center;
|
||||
}
|
||||
.uni-badge {
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
font-feature-settings: "tnum";
|
||||
min-width: 20px;
|
||||
justify-content: center;
|
||||
flex-direction: row;
|
||||
height: 20px;
|
||||
padding: 0 4px;
|
||||
line-height: 18px;
|
||||
color: #fff;
|
||||
border-radius: 100px;
|
||||
background-color: #909399;
|
||||
background-color: transparent;
|
||||
border: 1px solid #fff;
|
||||
text-align: center;
|
||||
font-family: "Helvetica Neue", Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
}
|
||||
.uni-badge--info {
|
||||
color: #fff;
|
||||
background-color: #909399;
|
||||
}
|
||||
.uni-badge--primary {
|
||||
background-color: #2979ff;
|
||||
}
|
||||
.uni-badge--success {
|
||||
background-color: #4cd964;
|
||||
}
|
||||
.uni-badge--warning {
|
||||
background-color: #f0ad4e;
|
||||
}
|
||||
.uni-badge--error {
|
||||
background-color: #dd524d;
|
||||
}
|
||||
.uni-badge--inverted {
|
||||
padding: 0 5px 0 0;
|
||||
color: #909399;
|
||||
}
|
||||
.uni-badge--info-inverted {
|
||||
color: #909399;
|
||||
background-color: transparent;
|
||||
}
|
||||
.uni-badge--primary-inverted {
|
||||
color: #2979ff;
|
||||
background-color: transparent;
|
||||
}
|
||||
.uni-badge--success-inverted {
|
||||
color: #4cd964;
|
||||
background-color: transparent;
|
||||
}
|
||||
.uni-badge--warning-inverted {
|
||||
color: #f0ad4e;
|
||||
background-color: transparent;
|
||||
}
|
||||
.uni-badge--error-inverted {
|
||||
color: #dd524d;
|
||||
background-color: transparent;
|
||||
}
|
||||
Reference in New Issue
Block a user