first commit
This commit is contained in:
80
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-badge/props.js
vendored
Normal file
80
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-badge/props.js
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = {
|
||||
props: {
|
||||
// 是否显示圆点
|
||||
isDot: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.isDot
|
||||
},
|
||||
// 显示的内容
|
||||
value: {
|
||||
type: [Number, String],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.value
|
||||
},
|
||||
// 显示的内容
|
||||
modelValue: {
|
||||
type: [Number, String],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.modelValue
|
||||
},
|
||||
// 是否显示
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.show
|
||||
},
|
||||
// 最大值,超过最大值会显示 '{max}+'
|
||||
max: {
|
||||
type: [Number, String],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.max
|
||||
},
|
||||
// 主题类型,error|warning|success|primary
|
||||
type: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.type
|
||||
},
|
||||
// 当数值为 0 时,是否展示 Badge
|
||||
showZero: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.showZero
|
||||
},
|
||||
// 背景颜色,优先级比type高,如设置,type参数会失效
|
||||
bgColor: {
|
||||
type: [String, null],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.bgColor
|
||||
},
|
||||
// 字体颜色
|
||||
color: {
|
||||
type: [String, null],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.color
|
||||
},
|
||||
// 徽标形状,circle-四角均为圆角,horn-左下角为直角
|
||||
shape: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.shape
|
||||
},
|
||||
// 设置数字的显示方式,overflow|ellipsis|limit
|
||||
// overflow会根据max字段判断,超出显示`${max}+`
|
||||
// ellipsis会根据max判断,超出显示`${max}...`
|
||||
// limit会依据1000作为判断条件,超出1000,显示`${value/1000}K`,比如2.2k、3.34w,最多保留2位小数
|
||||
numberType: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.numberType
|
||||
},
|
||||
// 设置badge的位置偏移,格式为 [x, y],也即设置的为top和right的值,absolute为true时有效
|
||||
offset: {
|
||||
type: Array,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.offset
|
||||
},
|
||||
// 是否反转背景和字体颜色
|
||||
inverted: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.inverted
|
||||
},
|
||||
// 是否绝对定位
|
||||
absolute: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.badge.absolute
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
71
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-badge/u-badge.acss
vendored
Normal file
71
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-badge/u-badge.acss
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
.u-empty.data-v-06cca9b7,
|
||||
.u-empty__wrap.data-v-06cca9b7,
|
||||
.u-tabs.data-v-06cca9b7,
|
||||
.u-tabs__wrapper.data-v-06cca9b7,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-06cca9b7,
|
||||
.u-tabs__wrapper__scroll-view.data-v-06cca9b7,
|
||||
.u-tabs__wrapper__nav.data-v-06cca9b7,
|
||||
.u-tabs__wrapper__nav__line.data-v-06cca9b7 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-badge.data-v-06cca9b7 {
|
||||
border-top-right-radius: 100px;
|
||||
border-top-left-radius: 100px;
|
||||
border-bottom-left-radius: 100px;
|
||||
border-bottom-right-radius: 100px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
line-height: 11px;
|
||||
text-align: center;
|
||||
font-size: 11px;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.u-badge--dot.data-v-06cca9b7 {
|
||||
height: 8px;
|
||||
width: 8px;
|
||||
}
|
||||
.u-badge--inverted.data-v-06cca9b7 {
|
||||
font-size: 13px;
|
||||
}
|
||||
.u-badge--not-dot.data-v-06cca9b7 {
|
||||
padding: 2px 5px;
|
||||
}
|
||||
.u-badge--horn.data-v-06cca9b7 {
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
.u-badge--primary.data-v-06cca9b7 {
|
||||
background-color: #3c9cff;
|
||||
}
|
||||
.u-badge--primary--inverted.data-v-06cca9b7 {
|
||||
color: #3c9cff;
|
||||
}
|
||||
.u-badge--error.data-v-06cca9b7 {
|
||||
background-color: #f56c6c;
|
||||
}
|
||||
.u-badge--error--inverted.data-v-06cca9b7 {
|
||||
color: #f56c6c;
|
||||
}
|
||||
.u-badge--success.data-v-06cca9b7 {
|
||||
background-color: #5ac725;
|
||||
}
|
||||
.u-badge--success--inverted.data-v-06cca9b7 {
|
||||
color: #5ac725;
|
||||
}
|
||||
.u-badge--info.data-v-06cca9b7 {
|
||||
background-color: #909399;
|
||||
}
|
||||
.u-badge--info--inverted.data-v-06cca9b7 {
|
||||
color: #909399;
|
||||
}
|
||||
.u-badge--warning.data-v-06cca9b7 {
|
||||
background-color: #f9ae3d;
|
||||
}
|
||||
.u-badge--warning--inverted.data-v-06cca9b7 {
|
||||
color: #f9ae3d;
|
||||
}
|
||||
1
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-badge/u-badge.axml
vendored
Normal file
1
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-badge/u-badge.axml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<text a:if="{{a}}" class="{{(c) + ' ' + d + ' ' + e + ' ' + f + ' ' + 'u-badge' + ' ' + 'data-v-06cca9b7'}}" style="{{g + ';' + h}}">{{b}}</text>
|
||||
67
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-badge/u-badge.js
vendored
Normal file
67
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-badge/u-badge.js
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_components_uBadge_props = require("./props.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mpMixin = require("../../libs/mixin/mpMixin.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mixin = require("../../libs/mixin/mixin.js");
|
||||
const uni_modules_uviewPlus_libs_function_index = require("../../libs/function/index.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "u-badge",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_components_uBadge_props.props, uni_modules_uviewPlus_libs_mixin_mixin.mixin],
|
||||
computed: {
|
||||
// 是否将badge中心与父组件右上角重合
|
||||
boxStyle() {
|
||||
let style = {};
|
||||
return style;
|
||||
},
|
||||
// 整个组件的样式
|
||||
badgeStyle() {
|
||||
const style = {};
|
||||
if (this.color) {
|
||||
style.color = this.color;
|
||||
}
|
||||
if (this.bgColor && !this.inverted) {
|
||||
style.backgroundColor = this.bgColor;
|
||||
}
|
||||
if (this.absolute) {
|
||||
style.position = "absolute";
|
||||
if (this.offset.length) {
|
||||
const top = this.offset[0];
|
||||
const right = this.offset[1] || top;
|
||||
style.top = uni_modules_uviewPlus_libs_function_index.addUnit(top);
|
||||
style.right = uni_modules_uviewPlus_libs_function_index.addUnit(right);
|
||||
}
|
||||
}
|
||||
return style;
|
||||
},
|
||||
showValue() {
|
||||
switch (this.numberType) {
|
||||
case "overflow":
|
||||
return Number(this.value) > Number(this.max) ? this.max + "+" : this.value;
|
||||
case "ellipsis":
|
||||
return Number(this.value) > Number(this.max) ? "..." : this.value;
|
||||
case "limit":
|
||||
return Number(this.value) > 999 ? Number(this.value) >= 9999 ? Math.floor(this.value / 1e4 * 100) / 100 + "w" : Math.floor(this.value / 1e3 * 100) / 100 + "k" : this.value;
|
||||
default:
|
||||
return Number(this.value);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addStyle: uni_modules_uviewPlus_libs_function_index.addStyle
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: _ctx.show && ((Number(_ctx.value) === 0 ? _ctx.showZero : true) || _ctx.isDot)
|
||||
}, _ctx.show && ((Number(_ctx.value) === 0 ? _ctx.showZero : true) || _ctx.isDot) ? {
|
||||
b: common_vendor.t(_ctx.isDot ? "" : $options.showValue),
|
||||
c: common_vendor.n(_ctx.isDot ? "u-badge--dot" : "u-badge--not-dot"),
|
||||
d: common_vendor.n(_ctx.inverted && "u-badge--inverted"),
|
||||
e: common_vendor.n(_ctx.shape === "horn" && "u-badge--horn"),
|
||||
f: common_vendor.n(`u-badge--${_ctx.type}${_ctx.inverted ? "--inverted" : ""}`),
|
||||
g: common_vendor.s($options.addStyle(_ctx.customStyle)),
|
||||
h: common_vendor.s($options.badgeStyle)
|
||||
} : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-06cca9b7"]]);
|
||||
my.createComponent(Component);
|
||||
5
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-badge/u-badge.json
vendored
Normal file
5
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-badge/u-badge.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {}
|
||||
}
|
||||
Reference in New Issue
Block a user