first commit

This commit is contained in:
PC-202306242200\Administrator
2026-03-28 23:09:02 +08:00
commit dac42e3b0c
3512 changed files with 181637 additions and 0 deletions

View File

@@ -0,0 +1,155 @@
"use strict";
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
const props = {
props: {
// 是否细边框
hairline: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.hairline
},
// 按钮的预置样式infoprimaryerrorwarningsuccess
type: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.type
},
// 按钮尺寸largenormalsmallmini
size: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.size
},
// 按钮形状circle两边为半圆square带圆角
shape: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.shape
},
// 按钮是否镂空
plain: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.plain
},
// 是否禁止状态
disabled: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.disabled
},
// 是否加载中
loading: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.loading
},
// 加载中提示文字
loadingText: {
type: [String, Number],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.loadingText
},
// 加载状态图标类型
loadingMode: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.loadingMode
},
// 加载图标大小
loadingSize: {
type: [String, Number],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.loadingSize
},
// 开放能力具体请看uniapp稳定关于button组件部分说明
// https://uniapp.dcloud.io/component/button
openType: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.openType
},
// 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件
// 取值为submit提交表单reset重置表单
formType: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.formType
},
// 打开 APP 时,向 APP 传递的参数open-type=launchApp时有效
// 只微信小程序、QQ小程序有效
appParameter: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.appParameter
},
// 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效
hoverStopPropagation: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.hoverStopPropagation
},
// 指定返回用户信息的语言zh_CN 简体中文zh_TW 繁体中文en 英文。只微信小程序有效
lang: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.lang
},
// 会话来源open-type="contact"时有效。只微信小程序有效
sessionFrom: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.sessionFrom
},
// 会话内消息卡片标题open-type="contact"时有效
// 默认当前标题,只微信小程序有效
sendMessageTitle: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.sendMessageTitle
},
// 会话内消息卡片点击跳转小程序路径open-type="contact"时有效
// 默认当前分享路径,只微信小程序有效
sendMessagePath: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.sendMessagePath
},
// 会话内消息卡片图片open-type="contact"时有效
// 默认当前页面截图,只微信小程序有效
sendMessageImg: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.sendMessageImg
},
// 是否显示会话内消息卡片,设置此参数为 true用户进入客服会话会在右下角显示"可能要发送的小程序"提示,
// 用户点击后可以快速发送小程序消息open-type="contact"时有效
showMessageCard: {
type: Boolean,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.showMessageCard
},
// 额外传参参数用于小程序的data-xxx属性通过target.dataset.name获取
dataName: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.dataName
},
// 节流,一定时间内只能触发一次
throttleTime: {
type: [String, Number],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.throttleTime
},
// 按住后多久出现点击态,单位毫秒
hoverStartTime: {
type: [String, Number],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.hoverStartTime
},
// 手指松开后点击态保留时间,单位毫秒
hoverStayTime: {
type: [String, Number],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.hoverStayTime
},
// 按钮文字之所以通过props传入是因为slot传入的话
// nvue中无法控制文字的样式
text: {
type: [String, Number],
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.text
},
// 按钮图标
icon: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.icon
},
// 按钮图标
iconColor: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.icon
},
// 按钮颜色支持传入linear-gradient渐变色
color: {
type: String,
default: () => uni_modules_uviewPlus_libs_config_props.defProps.button.color
}
}
};
exports.props = props;

View File

@@ -0,0 +1,163 @@
.u-empty.data-v-5ce41ee6,
.u-empty__wrap.data-v-5ce41ee6,
.u-tabs.data-v-5ce41ee6,
.u-tabs__wrapper.data-v-5ce41ee6,
.u-tabs__wrapper__scroll-view-wrapper.data-v-5ce41ee6,
.u-tabs__wrapper__scroll-view.data-v-5ce41ee6,
.u-tabs__wrapper__nav.data-v-5ce41ee6,
.u-tabs__wrapper__nav__line.data-v-5ce41ee6 {
display: flex;
flex-direction: column;
flex-shrink: 0;
flex-grow: 0;
flex-basis: auto;
align-items: stretch;
align-content: flex-start;
}
.u-button.data-v-5ce41ee6 {
width: 100%;
white-space: nowrap;
}
.u-button__text.data-v-5ce41ee6 {
white-space: nowrap;
line-height: 1;
}
.u-button.data-v-5ce41ee6:before {
position: absolute;
top: 50%;
left: 50%;
width: 100%;
height: 100%;
border: inherit;
border-radius: inherit;
transform: translate(-50%, -50%);
opacity: 0;
content: " ";
background-color: #000;
border-color: #000;
}
.u-button--active.data-v-5ce41ee6:before {
opacity: 0.15;
}
.u-button__icon + .u-button__text.data-v-5ce41ee6:not(:empty), .u-button__loading-text.data-v-5ce41ee6 {
margin-left: 4px;
}
.u-button--plain.u-button--primary.data-v-5ce41ee6 {
color: #3c9cff;
}
.u-button--plain.u-button--info.data-v-5ce41ee6 {
color: #909399;
}
.u-button--plain.u-button--success.data-v-5ce41ee6 {
color: #5ac725;
}
.u-button--plain.u-button--error.data-v-5ce41ee6 {
color: #f56c6c;
}
.u-button--plain.u-button--warning.data-v-5ce41ee6 {
color: #f56c6c;
}
.u-button.data-v-5ce41ee6 {
height: 38px;
position: relative;
align-items: center;
justify-content: center;
display: flex;
flex-direction: row;
box-sizing: border-box;
flex-direction: row;
}
.u-button__text.data-v-5ce41ee6 {
font-size: 15px;
}
.u-button__loading-text.data-v-5ce41ee6 {
font-size: 15px;
margin-left: 4px;
}
.u-button--large.data-v-5ce41ee6 {
width: 100%;
height: 50px;
padding: 0 15px;
}
.u-button--normal.data-v-5ce41ee6 {
padding: 0 12px;
font-size: 14px;
}
.u-button--small.data-v-5ce41ee6 {
min-width: 60px;
height: 30px;
padding: 0px 8px;
font-size: 12px;
}
.u-button--mini.data-v-5ce41ee6 {
height: 22px;
font-size: 10px;
min-width: 50px;
padding: 0px 8px;
}
.u-button--disabled.data-v-5ce41ee6 {
opacity: 0.5;
}
.u-button--info.data-v-5ce41ee6 {
color: #323233;
background-color: #fff;
border-color: #ebedf0;
border-width: 1px;
border-style: solid;
}
.u-button--success.data-v-5ce41ee6 {
color: #fff;
background-color: #5ac725;
border-color: #5ac725;
border-width: 1px;
border-style: solid;
}
.u-button--primary.data-v-5ce41ee6 {
color: #fff;
background-color: #3c9cff;
border-color: #3c9cff;
border-width: 1px;
border-style: solid;
}
.u-button--error.data-v-5ce41ee6 {
color: #fff;
background-color: #f56c6c;
border-color: #f56c6c;
border-width: 1px;
border-style: solid;
}
.u-button--warning.data-v-5ce41ee6 {
color: #fff;
background-color: #f9ae3d;
border-color: #f9ae3d;
border-width: 1px;
border-style: solid;
}
.u-button--block.data-v-5ce41ee6 {
display: flex;
flex-direction: row;
width: 100%;
}
.u-button--circle.data-v-5ce41ee6 {
border-top-right-radius: 100px;
border-top-left-radius: 100px;
border-bottom-left-radius: 100px;
border-bottom-right-radius: 100px;
}
.u-button--square.data-v-5ce41ee6 {
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.u-button__icon.data-v-5ce41ee6 {
min-width: 1em;
line-height: inherit !important;
vertical-align: top;
}
.u-button--plain.data-v-5ce41ee6 {
background-color: #fff;
}
.u-button--hairline.data-v-5ce41ee6 {
border-width: 0.5px !important;
}

View File

@@ -0,0 +1 @@
<button hover-start-time="{{i}}" hover-stay-time="{{j}}" form-type="{{k}}" open-type="{{l}}" app-parameter="{{m}}" hover-stop-propagation="{{n}}" send-message-title="{{o}}" send-message-path="{{p}}" lang="{{q}}" data-name="{{r}}" session-from="{{s}}" send-message-img="{{t}}" show-message-card="{{v}}" onGetphonenumber="{{w}}" onGetuserinfo="{{x}}" onError="{{y}}" onOpensetting="{{z}}" onLaunchapp="{{A}}" onAgreeprivacyauthorization="{{B}}" hover-class="{{C}}" style="{{D + ';' + E}}" onTap="{{F}}" class="{{('u-button') + ' ' + 'u-reset-button' + ' ' + 'data-v-5ce41ee6' + ' ' + G}}"><block a:if="{{a}}"><u-loading-icon class="data-v-5ce41ee6" u-i="5ce41ee6-0" onVI="__l" u-p="{{b}}"></u-loading-icon><text class="u-button__loading-text data-v-5ce41ee6" style="{{d}}">{{c}}</text></block><block a:else><u-icon a:if="{{e}}" class="data-v-5ce41ee6" u-i="5ce41ee6-1" onVI="__l" u-p="{{f}}"></u-icon><slot><text class="u-button__text data-v-5ce41ee6" style="{{h}}">{{g}}</text></slot></block></button>

View File

@@ -0,0 +1,207 @@
"use strict";
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_mixin_mpMixin = require("../../libs/mixin/mpMixin.js");
const uni_modules_uviewPlus_libs_mixin_mixin = require("../../libs/mixin/mixin.js");
const uni_modules_uviewPlus_components_uButton_props = require("./props.js");
const uni_modules_uviewPlus_libs_function_index = require("../../libs/function/index.js");
const uni_modules_uviewPlus_libs_function_throttle = require("../../libs/function/throttle.js");
const uni_modules_uviewPlus_libs_config_color = require("../../libs/config/color.js");
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "u-button",
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_libs_mixin_button.button, uni_modules_uviewPlus_libs_mixin_openType.openType, uni_modules_uviewPlus_components_uButton_props.props],
data() {
return {};
},
computed: {
// 生成bem风格的类名
bemClass() {
if (!this.color) {
return this.bem(
"button",
["type", "shape", "size"],
["disabled", "plain", "hairline"]
);
} else {
return this.bem(
"button",
["shape", "size"],
["disabled", "plain", "hairline"]
);
}
},
loadingColor() {
if (this.plain) {
return this.color ? this.color : uni_modules_uviewPlus_libs_config_color.color[`u-${this.type}`];
}
if (this.type === "info") {
return "#c9c9c9";
}
return "rgb(200, 200, 200)";
},
iconColorCom() {
if (this.iconColor)
return this.iconColor;
if (this.plain) {
return this.color ? this.color : this.type;
} else {
return this.type === "info" ? "#000000" : "#ffffff";
}
},
baseColor() {
let style = {};
if (this.color) {
style.color = this.plain ? this.color : "white";
if (!this.plain) {
style["background-color"] = this.color;
}
if (this.color.indexOf("gradient") !== -1) {
style.borderTopWidth = 0;
style.borderRightWidth = 0;
style.borderBottomWidth = 0;
style.borderLeftWidth = 0;
if (!this.plain) {
style.backgroundImage = this.color;
}
} else {
style.borderColor = this.color;
style.borderWidth = "1px";
style.borderStyle = "solid";
}
}
return style;
},
// nvue版本按钮的字体不会继承父组件的颜色需要对每一个text组件进行单独的设置
nvueTextStyle() {
let style = {};
if (this.type === "info") {
style.color = "#323233";
}
if (this.color) {
style.color = this.plain ? this.color : "white";
}
style.fontSize = this.textSize + "px";
return style;
},
// 字体大小
textSize() {
let fontSize = 14, { size } = this;
if (size === "large")
fontSize = 16;
if (size === "normal")
fontSize = 14;
if (size === "small")
fontSize = 12;
if (size === "mini")
fontSize = 10;
return fontSize;
}
},
emits: [
"click",
"getphonenumber",
"getuserinfo",
"error",
"opensetting",
"launchapp",
"agreeprivacyauthorization"
],
methods: {
addStyle: uni_modules_uviewPlus_libs_function_index.addStyle,
clickHandler() {
if (!this.disabled && !this.loading) {
uni_modules_uviewPlus_libs_function_throttle.throttle(() => {
this.$emit("click");
}, this.throttleTime);
}
},
// 下面为对接uniapp官方按钮开放能力事件回调的对接
getphonenumber(res) {
this.$emit("getphonenumber", res);
},
getuserinfo(res) {
this.$emit("getuserinfo", res);
},
error(res) {
this.$emit("error", res);
},
opensetting(res) {
this.$emit("opensetting", res);
},
launchapp(res) {
this.$emit("launchapp", res);
},
agreeprivacyauthorization(res) {
this.$emit("agreeprivacyauthorization", res);
}
}
};
if (!Array) {
const _easycom_u_loading_icon2 = common_vendor.resolveComponent("u-loading-icon");
const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
(_easycom_u_loading_icon2 + _easycom_u_icon2)();
}
const _easycom_u_loading_icon = () => "../u-loading-icon/u-loading-icon.js";
const _easycom_u_icon = () => "../u-icon/u-icon.js";
if (!Math) {
(_easycom_u_loading_icon + _easycom_u_icon)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: _ctx.loading
}, _ctx.loading ? {
b: common_vendor.p({
mode: _ctx.loadingMode,
size: _ctx.loadingSize * 1.15,
color: $options.loadingColor
}),
c: common_vendor.t(_ctx.loadingText || _ctx.text),
d: common_vendor.s({
fontSize: $options.textSize + "px"
})
} : common_vendor.e({
e: _ctx.icon
}, _ctx.icon ? {
f: common_vendor.p({
name: _ctx.icon,
color: $options.iconColorCom,
size: $options.textSize * 1.35,
customStyle: {
marginRight: "2px"
}
})
} : {}, {
g: common_vendor.t(_ctx.text),
h: common_vendor.s({
fontSize: $options.textSize + "px"
})
}), {
i: Number(_ctx.hoverStartTime),
j: Number(_ctx.hoverStayTime),
k: _ctx.formType,
l: _ctx.openType,
m: _ctx.appParameter,
n: _ctx.hoverStopPropagation,
o: _ctx.sendMessageTitle,
p: _ctx.sendMessagePath,
q: _ctx.lang,
r: _ctx.dataName,
s: _ctx.sessionFrom,
t: _ctx.sendMessageImg,
v: _ctx.showMessageCard,
w: common_vendor.o((...args) => $options.getphonenumber && $options.getphonenumber(...args)),
x: common_vendor.o((...args) => $options.getuserinfo && $options.getuserinfo(...args)),
y: common_vendor.o((...args) => $options.error && $options.error(...args)),
z: common_vendor.o((...args) => $options.opensetting && $options.opensetting(...args)),
A: common_vendor.o((...args) => $options.launchapp && $options.launchapp(...args)),
B: common_vendor.o((...args) => $options.agreeprivacyauthorization && $options.agreeprivacyauthorization(...args)),
C: !_ctx.disabled && !_ctx.loading ? "u-button--active" : "",
D: common_vendor.s($options.baseColor),
E: common_vendor.s($options.addStyle(_ctx.customStyle)),
F: common_vendor.o((...args) => $options.clickHandler && $options.clickHandler(...args)),
G: common_vendor.n($options.bemClass)
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-5ce41ee6"]]);
my.createComponent(Component);

View File

@@ -0,0 +1,8 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {
"u-loading-icon": "../u-loading-icon/u-loading-icon",
"u-icon": "../u-icon/u-icon"
}
}