first commit
This commit is contained in:
113
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-text/props.js
vendored
Normal file
113
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-text/props.js
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = {
|
||||
props: {
|
||||
// 主题颜色
|
||||
type: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.type
|
||||
},
|
||||
// 是否显示
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.show
|
||||
},
|
||||
// 显示的值
|
||||
text: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.text
|
||||
},
|
||||
// 前置图标
|
||||
prefixIcon: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.prefixIcon
|
||||
},
|
||||
// 后置图标
|
||||
suffixIcon: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.suffixIcon
|
||||
},
|
||||
// 文本处理的匹配模式
|
||||
// text-普通文本,price-价格,phone-手机号,name-姓名,date-日期,link-超链接
|
||||
mode: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.mode
|
||||
},
|
||||
// mode=link下,配置的链接
|
||||
href: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.href
|
||||
},
|
||||
// 格式化规则
|
||||
format: {
|
||||
type: [String, Function],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.format
|
||||
},
|
||||
// mode=phone时,点击文本是否拨打电话
|
||||
call: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.call
|
||||
},
|
||||
// 小程序的打开方式
|
||||
openType: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.openType
|
||||
},
|
||||
// 是否粗体,默认normal
|
||||
bold: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.bold
|
||||
},
|
||||
// 是否块状
|
||||
block: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.block
|
||||
},
|
||||
// 文本显示的行数,如果设置,超出此行数,将会显示省略号
|
||||
lines: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.lines
|
||||
},
|
||||
// 文本颜色
|
||||
color: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.color
|
||||
},
|
||||
// 字体大小
|
||||
size: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.size
|
||||
},
|
||||
// 图标的样式
|
||||
iconStyle: {
|
||||
type: [Object, String],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.iconStyle
|
||||
},
|
||||
// 文字装饰,下划线,中划线等,可选值 none|underline|line-through
|
||||
decoration: {
|
||||
tepe: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.decoration
|
||||
},
|
||||
// 外边距,对象、字符串,数值形式均可
|
||||
margin: {
|
||||
type: [Object, String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.margin
|
||||
},
|
||||
// 文本行高
|
||||
lineHeight: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.lineHeight
|
||||
},
|
||||
// 文本对齐方式,可选值left|center|right
|
||||
align: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.align
|
||||
},
|
||||
// 文字换行,可选值break-word|normal|anywhere
|
||||
wordWrap: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.text.wordWrap
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
64
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-text/u-text.acss
vendored
Normal file
64
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-text/u-text.acss
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
.u-empty.data-v-0a574502,
|
||||
.u-empty__wrap.data-v-0a574502,
|
||||
.u-tabs.data-v-0a574502,
|
||||
.u-tabs__wrapper.data-v-0a574502,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-0a574502,
|
||||
.u-tabs__wrapper__scroll-view.data-v-0a574502,
|
||||
.u-tabs__wrapper__nav.data-v-0a574502,
|
||||
.u-tabs__wrapper__nav__line.data-v-0a574502 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-text.data-v-0a574502 {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
}
|
||||
.u-text__price.data-v-0a574502 {
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
}
|
||||
.u-text__value.data-v-0a574502 {
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
color: #606266;
|
||||
flex-wrap: wrap;
|
||||
text-overflow: ellipsis;
|
||||
align-items: center;
|
||||
}
|
||||
.u-text__value--primary.data-v-0a574502 {
|
||||
color: #3c9cff;
|
||||
}
|
||||
.u-text__value--warning.data-v-0a574502 {
|
||||
color: #f9ae3d;
|
||||
}
|
||||
.u-text__value--success.data-v-0a574502 {
|
||||
color: #5ac725;
|
||||
}
|
||||
.u-text__value--info.data-v-0a574502 {
|
||||
color: #909399;
|
||||
}
|
||||
.u-text__value--error.data-v-0a574502 {
|
||||
color: #f56c6c;
|
||||
}
|
||||
.u-text__value--main.data-v-0a574502 {
|
||||
color: #303133;
|
||||
}
|
||||
.u-text__value--content.data-v-0a574502 {
|
||||
color: #606266;
|
||||
}
|
||||
.u-text__value--tips.data-v-0a574502 {
|
||||
color: #909193;
|
||||
}
|
||||
.u-text__value--light.data-v-0a574502 {
|
||||
color: #c0c4cc;
|
||||
}
|
||||
1
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-text/u-text.axml
vendored
Normal file
1
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-text/u-text.axml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view a:if="{{a}}" class="{{('u-text') + ' ' + 'data-v-0a574502'}}" style="{{'margin:' + M + ';' + ('justify-content:' + N)}}" onTap="{{O}}"><text a:if="{{b}}" class="{{('data-v-0a574502') + ' ' + 'u-text__price' + ' ' + c}}" style="{{d}}">¥</text><view a:if="{{e}}" class="u-text__prefix-icon data-v-0a574502"><u-icon class="data-v-0a574502" u-i="0a574502-0" onVI="__l" u-p="{{f}}"></u-icon></view><u-link a:if="{{g}}" style="{{'font-weight:' + h + ';' + ('word-wrap:' + i) + ';' + ('font-size:' + j)}}" class="{{('u-text__value') + ' ' + 'data-v-0a574502' + ' ' + k + ' ' + l}}" u-i="0a574502-1" onVI="__l" u-p="{{m}}"></u-link><block a:elif="{{n}}"><button class="u-reset-button u-text__value data-v-0a574502" style="{{p}}" data-index="{{q}}" openType="{{r}}" onGetuserinfo="{{s}}" onContact="{{t}}" onGetphonenumber="{{v}}" onError="{{w}}" onLaunchapp="{{x}}" onOpensetting="{{y}}" lang="{{z}}" session-from="{{A}}" send-message-title="{{B}}" send-message-path="{{C}}" send-message-img="{{D}}" show-message-card="{{E}}" app-parameter="{{F}}">{{o}}</button></block><text a:else style="{{H}}" class="{{('u-text__value') + ' ' + 'data-v-0a574502' + ' ' + I + ' ' + J}}">{{G}}</text><view a:if="{{K}}" class="u-text__suffix-icon data-v-0a574502"><u-icon class="data-v-0a574502" u-i="0a574502-2" onVI="__l" u-p="{{L}}"></u-icon></view></view>
|
||||
129
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-text/u-text.js
vendored
Normal file
129
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-text/u-text.js
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_uviewPlus_components_uText_props = require("./props.js");
|
||||
const uni_modules_uviewPlus_components_uText_value = require("./value.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_mixin_button = require("../../libs/mixin/button.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_openType = require("../../libs/mixin/openType.js");
|
||||
const uni_modules_uviewPlus_libs_function_index = require("../../libs/function/index.js");
|
||||
const _sfc_main = {
|
||||
name: "u--text",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uText_value.value, uni_modules_uviewPlus_libs_mixin_button.button, uni_modules_uviewPlus_libs_mixin_openType.openType, uni_modules_uviewPlus_components_uText_props.props],
|
||||
emits: ["click"],
|
||||
computed: {
|
||||
valueStyle() {
|
||||
const style = {
|
||||
textDecoration: this.decoration,
|
||||
fontWeight: this.bold ? "bold" : "normal",
|
||||
wordWrap: this.wordWrap,
|
||||
fontSize: uni_modules_uviewPlus_libs_function_index.addUnit(this.size)
|
||||
};
|
||||
!this.type && (style.color = this.color);
|
||||
this.isNvue && this.lines && (style.lines = this.lines);
|
||||
this.lineHeight && (style.lineHeight = uni_modules_uviewPlus_libs_function_index.addUnit(this.lineHeight));
|
||||
!this.isNvue && this.block && (style.display = "block");
|
||||
return uni_modules_uviewPlus_libs_function_index.deepMerge(style, uni_modules_uviewPlus_libs_function_index.addStyle(this.customStyle));
|
||||
},
|
||||
isNvue() {
|
||||
let nvue = false;
|
||||
return nvue;
|
||||
},
|
||||
isMp() {
|
||||
let mp = false;
|
||||
mp = true;
|
||||
return mp;
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
addStyle: uni_modules_uviewPlus_libs_function_index.addStyle,
|
||||
clickHandler() {
|
||||
if (this.call && this.mode === "phone") {
|
||||
common_vendor.index.makePhoneCall({
|
||||
phoneNumber: this.text
|
||||
});
|
||||
}
|
||||
this.$emit("click");
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
|
||||
const _easycom_u_link2 = common_vendor.resolveComponent("u-link");
|
||||
(_easycom_u_icon2 + _easycom_u_link2)();
|
||||
}
|
||||
const _easycom_u_icon = () => "../u-icon/u-icon.js";
|
||||
const _easycom_u_link = () => "../u-link/u-link.js";
|
||||
if (!Math) {
|
||||
(_easycom_u_icon + _easycom_u_link)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: _ctx.show
|
||||
}, _ctx.show ? common_vendor.e({
|
||||
b: _ctx.mode === "price"
|
||||
}, _ctx.mode === "price" ? {
|
||||
c: common_vendor.n(_ctx.type && `u-text__value--${_ctx.type}`),
|
||||
d: common_vendor.s($options.valueStyle)
|
||||
} : {}, {
|
||||
e: _ctx.prefixIcon
|
||||
}, _ctx.prefixIcon ? {
|
||||
f: common_vendor.p({
|
||||
name: _ctx.prefixIcon,
|
||||
customStyle: $options.addStyle(_ctx.iconStyle)
|
||||
})
|
||||
} : {}, {
|
||||
g: _ctx.mode === "link"
|
||||
}, _ctx.mode === "link" ? {
|
||||
h: $options.valueStyle.fontWeight,
|
||||
i: $options.valueStyle.wordWrap,
|
||||
j: $options.valueStyle.fontSize,
|
||||
k: common_vendor.n(_ctx.type && `u-text__value--${_ctx.type}`),
|
||||
l: common_vendor.n(_ctx.lines && `u-line-${_ctx.lines}`),
|
||||
m: common_vendor.p({
|
||||
text: _ctx.value,
|
||||
href: _ctx.href,
|
||||
underLine: true
|
||||
})
|
||||
} : _ctx.openType && $options.isMp ? {
|
||||
o: common_vendor.t(_ctx.value),
|
||||
p: common_vendor.s($options.valueStyle),
|
||||
q: _ctx.index,
|
||||
r: _ctx.openType,
|
||||
s: common_vendor.o((...args) => _ctx.onGetUserInfo && _ctx.onGetUserInfo(...args)),
|
||||
t: common_vendor.o((...args) => _ctx.onContact && _ctx.onContact(...args)),
|
||||
v: common_vendor.o((...args) => _ctx.onGetPhoneNumber && _ctx.onGetPhoneNumber(...args)),
|
||||
w: common_vendor.o((...args) => _ctx.onError && _ctx.onError(...args)),
|
||||
x: common_vendor.o((...args) => _ctx.onLaunchApp && _ctx.onLaunchApp(...args)),
|
||||
y: common_vendor.o((...args) => _ctx.onOpenSetting && _ctx.onOpenSetting(...args)),
|
||||
z: _ctx.lang,
|
||||
A: _ctx.sessionFrom,
|
||||
B: _ctx.sendMessageTitle,
|
||||
C: _ctx.sendMessagePath,
|
||||
D: _ctx.sendMessageImg,
|
||||
E: _ctx.showMessageCard,
|
||||
F: _ctx.appParameter
|
||||
} : {
|
||||
G: common_vendor.t(_ctx.value),
|
||||
H: common_vendor.s($options.valueStyle),
|
||||
I: common_vendor.n(_ctx.type && `u-text__value--${_ctx.type}`),
|
||||
J: common_vendor.n(_ctx.lines && `u-line-${_ctx.lines}`)
|
||||
}, {
|
||||
n: _ctx.openType && $options.isMp,
|
||||
K: _ctx.suffixIcon
|
||||
}, _ctx.suffixIcon ? {
|
||||
L: common_vendor.p({
|
||||
name: _ctx.suffixIcon,
|
||||
customStyle: $options.addStyle(_ctx.iconStyle)
|
||||
})
|
||||
} : {}, {
|
||||
M: _ctx.margin,
|
||||
N: _ctx.align === "left" ? "flex-start" : _ctx.align === "center" ? "center" : "flex-end",
|
||||
O: common_vendor.o((...args) => $options.clickHandler && $options.clickHandler(...args))
|
||||
}) : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-0a574502"]]);
|
||||
my.createComponent(Component);
|
||||
8
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-text/u-text.json
vendored
Normal file
8
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-text/u-text.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {
|
||||
"u-icon": "../u-icon/u-icon",
|
||||
"u-link": "../u-link/u-link"
|
||||
}
|
||||
}
|
||||
78
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-text/value.js
vendored
Normal file
78
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-text/value.js
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_function_index = require("../../libs/function/index.js");
|
||||
const uni_modules_uviewPlus_libs_function_test = require("../../libs/function/test.js");
|
||||
const value = {
|
||||
computed: {
|
||||
// 经处理后需要显示的值
|
||||
value() {
|
||||
const {
|
||||
text,
|
||||
mode,
|
||||
format,
|
||||
href
|
||||
} = this;
|
||||
if (mode === "price") {
|
||||
if (!/^\d+(\.\d+)?$/.test(text)) {
|
||||
uni_modules_uviewPlus_libs_function_index.error("金额模式下,text参数需要为金额格式");
|
||||
}
|
||||
if (uni_modules_uviewPlus_libs_function_test.test.func(format)) {
|
||||
return format(text);
|
||||
}
|
||||
return uni_modules_uviewPlus_libs_function_index.priceFormat(text, 2);
|
||||
}
|
||||
if (mode === "date") {
|
||||
!uni_modules_uviewPlus_libs_function_test.test.date(text) && uni_modules_uviewPlus_libs_function_index.error("日期模式下,text参数需要为日期或时间戳格式");
|
||||
if (uni_modules_uviewPlus_libs_function_test.test.func(format)) {
|
||||
return format(text);
|
||||
}
|
||||
if (format) {
|
||||
return uni_modules_uviewPlus_libs_function_index.timeFormat(text, format);
|
||||
}
|
||||
return uni_modules_uviewPlus_libs_function_index.timeFormat(text, "yyyy-mm-dd");
|
||||
}
|
||||
if (mode === "phone") {
|
||||
if (uni_modules_uviewPlus_libs_function_test.test.func(format)) {
|
||||
return format(text);
|
||||
}
|
||||
if (format === "encrypt") {
|
||||
return `${text.substr(0, 3)}****${text.substr(7)}`;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
if (mode === "name") {
|
||||
!(typeof text === "string") && uni_modules_uviewPlus_libs_function_index.error("姓名模式下,text参数需要为字符串格式");
|
||||
if (uni_modules_uviewPlus_libs_function_test.test.func(format)) {
|
||||
return format(text);
|
||||
}
|
||||
if (format === "encrypt") {
|
||||
return this.formatName(text);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
if (mode === "link") {
|
||||
!uni_modules_uviewPlus_libs_function_test.test.url(href) && uni_modules_uviewPlus_libs_function_index.error("超链接模式下,href参数需要为URL格式");
|
||||
return text;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 默认的姓名脱敏规则
|
||||
formatName(name) {
|
||||
let value2 = "";
|
||||
if (name.length === 2) {
|
||||
value2 = name.substr(0, 1) + "*";
|
||||
} else if (name.length > 2) {
|
||||
let char = "";
|
||||
for (let i = 0, len = name.length - 2; i < len; i++) {
|
||||
char += "*";
|
||||
}
|
||||
value2 = name.substr(0, 1) + char + name.substr(-1, 1);
|
||||
} else {
|
||||
value2 = name;
|
||||
}
|
||||
return value2;
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.value = value;
|
||||
Reference in New Issue
Block a user