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,67 @@
"use strict";
require("../../libs/config/config.js");
require("../../libs/config/props/datetimePicker.js");
require("../../libs/config/props/icon.js");
require("../../libs/config/props/link.js");
require("../../libs/config/props/loadingIcon.js");
require("../../libs/config/props/navbar.js");
const props = {
props: {
// 菜单标题和选项的激活态颜色
activeColor: {
type: String,
default: "#2979ff"
},
// 菜单标题和选项的未激活态颜色
inactiveColor: {
type: String,
default: "#606266"
},
// 点击遮罩是否关闭菜单
closeOnClickMask: {
type: Boolean,
default: true
},
// 点击当前激活项标题是否关闭菜单
closeOnClickSelf: {
type: Boolean,
default: true
},
// 过渡时间
duration: {
type: [Number, String],
default: 300
},
// 标题菜单的高度
height: {
type: [Number, String],
default: 40
},
// 是否显示下边框
borderBottom: {
type: Boolean,
default: false
},
// 标题的字体大小
titleSize: {
type: [Number, String],
default: 14
},
// 下拉出来的内容部分的圆角值
borderRadius: {
type: [Number, String],
default: 0
},
// 菜单右侧的icon图标
menuIcon: {
type: String,
default: "arrow-down"
},
// 菜单右侧图标的大小
menuIconSize: {
type: [Number, String],
default: 14
}
}
};
exports.props = props;

View File

@@ -0,0 +1,76 @@
.u-empty.data-v-029e9a16,
.u-empty__wrap.data-v-029e9a16,
.u-tabs.data-v-029e9a16,
.u-tabs__wrapper.data-v-029e9a16,
.u-tabs__wrapper__scroll-view-wrapper.data-v-029e9a16,
.u-tabs__wrapper__scroll-view.data-v-029e9a16,
.u-tabs__wrapper__nav.data-v-029e9a16,
.u-tabs__wrapper__nav__line.data-v-029e9a16 {
display: flex;
flex-direction: column;
flex-shrink: 0;
flex-grow: 0;
flex-basis: auto;
align-items: stretch;
align-content: flex-start;
}
.u-dropdown.data-v-029e9a16 {
flex: 1;
width: 100%;
position: relative;
}
.u-dropdown__menu.data-v-029e9a16 {
display: flex;
flex-direction: row;
position: relative;
z-index: 11;
height: 80rpx;
}
.u-dropdown__menu__item.data-v-029e9a16 {
flex: 1;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
.u-dropdown__menu__item .u-flex-row.data-v-029e9a16 {
flex-direction: row;
}
.u-dropdown__menu__item__text.data-v-029e9a16 {
font-size: 28rpx;
color: #606266;
}
.u-dropdown__menu__item__arrow.data-v-029e9a16 {
margin-left: 6rpx;
transition: transform 0.3s;
align-items: center;
display: flex;
flex-direction: row;
}
.u-dropdown__menu__item__arrow--rotate.data-v-029e9a16 {
transform: rotate(180deg);
}
.u-dropdown__content.data-v-029e9a16 {
position: absolute;
z-index: 8;
width: 100%;
left: 0px;
bottom: 0;
overflow: hidden;
}
.u-dropdown__content__mask.data-v-029e9a16 {
position: absolute;
z-index: 9;
background: rgba(0, 0, 0, 0.3);
width: 100%;
left: 0;
top: 0;
bottom: 0;
}
.u-dropdown__content__popup.data-v-029e9a16 {
position: relative;
z-index: 10;
transition: all 0.3s;
transform: translate3D(0, -100%, 0);
overflow: hidden;
}

View File

@@ -0,0 +1 @@
<view class="u-dropdown data-v-029e9a16"><view style="{{'height:' + c}}" class="{{('u-dropdown__menu') + ' ' + 'data-v-029e9a16' + ' ' + (d && 'u-border-bottom')}}"><view a:for="{{a}}" a:for-item="item" a:key="f" class="u-dropdown__menu__item data-v-029e9a16" catchTap="{{item.g}}"><view class="u-flex u-flex-row data-v-029e9a16"><text class="u-dropdown__menu__item__text data-v-029e9a16" style="{{'color:' + item.b + ';' + ('font-size:' + b)}}">{{item.a}}</text><view class="{{('u-dropdown__menu__item__arrow') + ' ' + 'data-v-029e9a16' + ' ' + (item.e && 'u-dropdown__menu__item__arrow--rotate')}}"><u-icon class="data-v-029e9a16" u-i="{{item.c}}" onVI="__l" u-p="{{item.d}}"></u-icon></view></view></view></view><view class="u-dropdown__content data-v-029e9a16" style="{{g + ';' + h}}" onTap="{{i}}" catchTouchMove="{{j}}"><view catchTap="{{e}}" class="u-dropdown__content__popup data-v-029e9a16" style="{{f}}"><slot></slot></view><view class="u-dropdown__content__mask data-v-029e9a16"></view></view></view>

View File

@@ -0,0 +1,158 @@
"use strict";
const uni_modules_uviewPlus_components_uDropdown_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-dropdown",
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uDropdown_props.props],
data() {
return {
showDropdown: true,
// 是否打开下来菜单,
menuList: [],
// 显示的菜单
active: false,
// 下拉菜单的状态
// 当前是第几个菜单处于激活状态小程序中此处不能写成false或者""否则后续将current赋值为0
// 无能的TX没有使用===而是使用==判断,导致程序认为前后二者没有变化,从而不会触发视图更新
current: 99999,
// 外层内容的样式,初始时处于底层,且透明
contentStyle: {
zIndex: -1,
opacity: 0
},
// 让某个菜单保持高亮的状态
highlightIndex: 99999,
contentHeight: 0
};
},
computed: {
// 下拉出来部分的样式
popupStyle() {
let style = {};
style.transform = `translateY(${this.active ? 0 : "-100%"})`;
style["transition-duration"] = this.duration / 1e3 + "s";
style.borderRadius = `0 0 ${uni_modules_uviewPlus_libs_function_index.addUnit(this.borderRadius)} ${uni_modules_uviewPlus_libs_function_index.addUnit(this.borderRadius)}`;
return style;
}
},
created() {
this.children = [];
},
mounted() {
this.getContentHeight();
},
emits: ["open", "close"],
methods: {
addUnit: uni_modules_uviewPlus_libs_function_index.addUnit,
init() {
this.menuList = [];
this.children.map((child) => {
child.init();
});
},
// 点击菜单
menuClick(index) {
if (this.menuList[index].disabled)
return;
if (index === this.current && this.closeOnClickSelf) {
this.close();
setTimeout(() => {
this.children[index].active = false;
}, this.duration);
return;
}
this.open(index);
},
// 打开下拉菜单
open(index) {
if (this.contentHeight < 1)
this.getContentHeight();
this.contentStyle = {
zIndex: 11
};
this.active = true;
this.current = index;
this.children.map((val, idx) => {
val.active = index == idx ? true : false;
});
this.$emit("open", this.current);
},
// 设置下拉菜单处于收起状态
close() {
this.$emit("close", this.current);
this.active = false;
this.current = 99999;
this.contentStyle = {
zIndex: -1,
opacity: 0
};
},
// 点击遮罩
maskClick() {
if (!this.closeOnClickMask)
return;
this.close();
},
// 外部手动设置某个菜单高亮
highlight(index = void 0) {
this.highlightIndex = index !== void 0 ? index : 99999;
},
// 获取下拉菜单内容的高度
getContentHeight() {
let windowHeight = uni_modules_uviewPlus_libs_function_index.sys().windowHeight;
this.$uGetRect(".u-dropdown__menu").then((res) => {
this.contentHeight = windowHeight - res.bottom;
});
}
}
};
if (!Array) {
const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
_easycom_u_icon2();
}
const _easycom_u_icon = () => "../u-icon/u-icon.js";
if (!Math) {
_easycom_u_icon();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.f($data.menuList, (item, index, i0) => {
return {
a: common_vendor.t(item.title),
b: item.disabled ? "#c0c4cc" : index === $data.current || $data.highlightIndex == index ? _ctx.activeColor : _ctx.inactiveColor,
c: "029e9a16-0-" + i0,
d: common_vendor.p({
["custom-style"]: {
display: "flex"
},
name: _ctx.menuIcon,
size: $options.addUnit(_ctx.menuIconSize),
color: index === $data.current || $data.highlightIndex == index ? _ctx.activeColor : "#c0c4cc"
}),
e: index === $data.current ? 1 : "",
f: index,
g: common_vendor.o(($event) => $options.menuClick(index))
};
}),
b: $options.addUnit(_ctx.titleSize),
c: $options.addUnit(_ctx.height),
d: _ctx.borderBottom ? 1 : "",
e: common_vendor.o(() => {
}),
f: common_vendor.s($options.popupStyle),
g: common_vendor.s($data.contentStyle),
h: common_vendor.s({
transition: `opacity ${_ctx.duration / 1e3}s linear`,
top: $options.addUnit(_ctx.height),
height: $data.contentHeight + "px"
}),
i: common_vendor.o((...args) => $options.maskClick && $options.maskClick(...args)),
j: common_vendor.o(() => {
})
};
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-029e9a16"]]);
my.createComponent(Component);

View File

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