This commit is contained in:
zoujiandong
2025-07-30 13:43:14 +08:00
parent 4ca1b9cf42
commit afc79a0f26
405 changed files with 765 additions and 27730 deletions
@@ -1,171 +0,0 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "u-toast",
mixins: [common_vendor.mpMixin, common_vendor.mixin],
data() {
return {
isShow: false,
timer: null,
// 定时器
config: {
message: "",
// 显示文本
type: "",
// 主题类型,primarysuccesserrorwarningblack
duration: 2e3,
// 显示的时间,毫秒
icon: true,
// 显示的图标
position: "center",
// toast出现的位置
complete: null,
// 执行完后的回调函数
overlay: true,
// 是否防止触摸穿透
loading: false
// 是否加载中状态
},
tmpConfig: {}
// 将用户配置和内置配置合并后的临时配置变量
};
},
computed: {
iconName() {
if (!this.tmpConfig.icon || this.tmpConfig.icon == "none") {
return "";
}
if (this.tmpConfig.icon === true) {
if (["error", "warning", "success", "primary"].includes(this.tmpConfig.type)) {
return common_vendor.type2icon(this.tmpConfig.type);
} else {
return "";
}
} else {
return this.tmpConfig.icon;
}
},
overlayStyle() {
const style = {
justifyContent: "center",
alignItems: "center",
display: "flex"
};
style.backgroundColor = "rgba(0, 0, 0, 0)";
return style;
},
iconStyle() {
const style = {};
style.marginRight = "4px";
return style;
},
loadingIconColor() {
let colorTmp = "rgb(255, 255, 255)";
if (["error", "warning", "success", "primary"].includes(this.tmpConfig.type)) {
colorTmp = common_vendor.hexToRgb(common_vendor.color[this.tmpConfig.type]);
}
return colorTmp;
},
// 内容盒子的样式
contentStyle() {
const windowHeight = common_vendor.getWindowInfo().windowHeight, style = {};
let value = 0;
if (this.tmpConfig.position === "top") {
value = -windowHeight * 0.25;
} else if (this.tmpConfig.position === "bottom") {
value = windowHeight * 0.25;
}
style.transform = `translateY(${value}px)`;
return style;
}
},
created() {
["primary", "success", "error", "warning", "default", "loading"].map((item) => {
this[item] = (message) => this.show({
type: item,
message
});
});
},
methods: {
// 显示toast组件,由父组件通过this.$refs.xxx.show(options)形式调用
show(options) {
this.tmpConfig = common_vendor.deepMerge(this.config, options);
this.clearTimer();
this.isShow = true;
if (this.tmpConfig.duration !== -1) {
this.timer = setTimeout(() => {
this.clearTimer();
typeof this.tmpConfig.complete === "function" && this.tmpConfig.complete();
}, this.tmpConfig.duration);
}
},
// 隐藏toast组件,由父组件通过this.$refs.xxx.hide()形式调用
hide() {
this.clearTimer();
},
clearTimer() {
this.isShow = false;
clearTimeout(this.timer);
this.timer = null;
}
},
beforeUnmount() {
this.clearTimer();
}
};
if (!Array) {
const _easycom_u_loading_icon2 = common_vendor.resolveComponent("u-loading-icon");
const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
const _easycom_u_gap2 = common_vendor.resolveComponent("u-gap");
const _easycom_u_overlay2 = common_vendor.resolveComponent("u-overlay");
(_easycom_u_loading_icon2 + _easycom_u_icon2 + _easycom_u_gap2 + _easycom_u_overlay2)();
}
const _easycom_u_loading_icon = () => "../u-loading-icon/u-loading-icon.js";
const _easycom_u_icon = () => "../u-icon/u-icon.js";
const _easycom_u_gap = () => "../u-gap/u-gap.js";
const _easycom_u_overlay = () => "../u-overlay/u-overlay.js";
if (!Math) {
(_easycom_u_loading_icon + _easycom_u_icon + _easycom_u_gap + _easycom_u_overlay)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $data.tmpConfig.type === "loading"
}, $data.tmpConfig.type === "loading" ? {
b: common_vendor.p({
mode: "circle",
color: "rgb(255, 255, 255)",
inactiveColor: "rgb(120, 120, 120)",
size: "25"
})
} : $data.tmpConfig.type !== "defalut" && $options.iconName ? {
d: common_vendor.p({
name: $options.iconName,
size: "17",
color: $data.tmpConfig.type,
customStyle: $options.iconStyle
})
} : {}, {
c: $data.tmpConfig.type !== "defalut" && $options.iconName,
e: $data.tmpConfig.type === "loading" || $data.tmpConfig.loading
}, $data.tmpConfig.type === "loading" || $data.tmpConfig.loading ? {
f: common_vendor.p({
height: "12",
bgColor: "transparent"
})
} : {}, {
g: common_vendor.t($data.tmpConfig.message),
h: common_vendor.n("u-toast__content__text--" + $data.tmpConfig.type),
i: common_vendor.s($options.contentStyle),
j: common_vendor.n("u-type-" + $data.tmpConfig.type),
k: common_vendor.n($data.tmpConfig.type === "loading" || $data.tmpConfig.loading ? "u-toast__content--loading" : ""),
l: common_vendor.p({
show: $data.isShow,
zIndex: $data.tmpConfig.overlay ? 10070 : -1,
["custom-style"]: $options.overlayStyle
})
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2232870a"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/node-modules/uview-plus/components/u-toast/u-toast.js.map
@@ -1,9 +0,0 @@
{
"component": true,
"usingComponents": {
"u-loading-icon": "../u-loading-icon/u-loading-icon",
"u-icon": "../u-icon/u-icon",
"u-gap": "../u-gap/u-gap",
"u-overlay": "../u-overlay/u-overlay"
}
}
@@ -1 +0,0 @@
<view class="u-toast data-v-2232870a"><u-overlay wx:if="{{l}}" class="data-v-2232870a" u-s="{{['d']}}" u-i="2232870a-0" bind:__l="__l" u-p="{{l}}"><view style="{{i}}" class="{{['u-toast__content', 'data-v-2232870a', j, k]}}"><u-loading-icon wx:if="{{a}}" class="data-v-2232870a" u-i="2232870a-1,2232870a-0" bind:__l="__l" u-p="{{b}}"></u-loading-icon><u-icon wx:elif="{{c}}" class="data-v-2232870a" u-i="2232870a-2,2232870a-0" bind:__l="__l" u-p="{{d}}"></u-icon><u-gap wx:if="{{e}}" class="data-v-2232870a" u-i="2232870a-3,2232870a-0" bind:__l="__l" u-p="{{f}}"></u-gap><text class="{{['u-toast__content__text', 'data-v-2232870a', h]}}" style="max-width:400rpx">{{g}}</text></view></u-overlay></view>
@@ -1,112 +0,0 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.u-empty.data-v-2232870a,
.u-empty__wrap.data-v-2232870a,
.u-tabs.data-v-2232870a,
.u-tabs__wrapper.data-v-2232870a,
.u-tabs__wrapper__scroll-view-wrapper.data-v-2232870a,
.u-tabs__wrapper__scroll-view.data-v-2232870a,
.u-tabs__wrapper__nav.data-v-2232870a,
.u-tabs__wrapper__nav__line.data-v-2232870a,
.up-empty.data-v-2232870a,
.up-empty__wrap.data-v-2232870a,
.up-tabs.data-v-2232870a,
.up-tabs__wrapper.data-v-2232870a,
.up-tabs__wrapper__scroll-view-wrapper.data-v-2232870a,
.up-tabs__wrapper__scroll-view.data-v-2232870a,
.up-tabs__wrapper__nav.data-v-2232870a,
.up-tabs__wrapper__nav__line.data-v-2232870a {
display: flex;
flex-direction: column;
flex-shrink: 0;
flex-grow: 0;
flex-basis: auto;
align-items: stretch;
align-content: flex-start;
}
.u-toast__content.data-v-2232870a {
display: flex;
flex-direction: row;
padding: 12px 20px;
border-radius: 4px;
background-color: #585858;
color: #fff;
align-items: center;
max-width: 600rpx;
position: relative;
}
.u-toast__content--loading.data-v-2232870a {
flex-direction: column;
padding: 20px 20px;
}
.u-toast__content__text.data-v-2232870a {
color: #fff;
font-size: 15px;
line-height: 15px;
}
.u-toast__content__text--default.data-v-2232870a {
color: #fff;
}
.u-toast__content__text--error.data-v-2232870a {
color: #f56c6c;
}
.u-toast__content__text--primary.data-v-2232870a {
color: #3c9cff;
}
.u-toast__content__text--success.data-v-2232870a {
color: #5ac725;
}
.u-toast__content__text--warning.data-v-2232870a {
color: #f9ae3d;
}
.u-type-primary.data-v-2232870a {
color: #3c9cff;
background-color: #ecf5ff;
border-color: #d7eafe;
border-width: 1px;
}
.u-type-success.data-v-2232870a {
color: #5ac725;
background-color: #dbf1e1;
border-color: #BEF5C8;
border-width: 1px;
}
.u-type-error.data-v-2232870a {
color: #f56c6c;
background-color: #fef0f0;
border-color: #fde2e2;
border-width: 1px;
}
.u-type-warning.data-v-2232870a {
color: #f9ae3d;
background-color: #fdf6ec;
border-color: #faecd8;
border-width: 1px;
}
.u-type-default.data-v-2232870a {
color: #fff;
background-color: #585858;
}