first commit
This commit is contained in:
44
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-dropdown-item/props.js
vendored
Normal file
44
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-dropdown-item/props.js
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"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: {
|
||||
// 当前选中项的value值
|
||||
modelValue: {
|
||||
type: [Number, String, Array],
|
||||
default: ""
|
||||
},
|
||||
// 菜单项标题
|
||||
title: {
|
||||
type: [String, Number],
|
||||
default: ""
|
||||
},
|
||||
// 选项数据,如果传入了默认slot,此参数无效
|
||||
options: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
// 是否禁用此菜单项
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 下拉弹窗的高度
|
||||
height: {
|
||||
type: [Number, String],
|
||||
default: "auto"
|
||||
},
|
||||
// 点击遮罩是否可以收起弹窗
|
||||
closeOnClickOverlay: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
@@ -0,0 +1,19 @@
|
||||
.u-empty.data-v-2ab01489,
|
||||
.u-empty__wrap.data-v-2ab01489,
|
||||
.u-tabs.data-v-2ab01489,
|
||||
.u-tabs__wrapper.data-v-2ab01489,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-2ab01489,
|
||||
.u-tabs__wrapper__scroll-view.data-v-2ab01489,
|
||||
.u-tabs__wrapper__nav.data-v-2ab01489,
|
||||
.u-tabs__wrapper__nav__line.data-v-2ab01489 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-dropdown-item__scroll.data-v-2ab01489 {
|
||||
background: #ffffff;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view a:if="{{a}}" class="u-dropdown-item data-v-2ab01489" catchTouchMove="{{e}}" catchTap="{{f}}"><block a:if="{{b}}"><scroll-view class="u-dropdown-item__scroll data-v-2ab01489" scroll-y="true" style="{{'height:' + d}}"><view class="u-dropdown-item__options data-v-2ab01489"><up-cell-group class="data-v-2ab01489" u-s="{{['d']}}" u-i="2ab01489-0" onVI="__l"><up-cell a:for="{{c}}" a:for-item="item" a:key="e" class="data-v-2ab01489" u-s="{{['d']}}" onClick="{{item.d}}" u-i="{{item.f}}" onVI="__l" u-p="{{item.g}}"><up-icon a:if="{{item.a}}" class="data-v-2ab01489" u-i="{{item.b}}" onVI="__l" u-p="{{item.c}}"></up-icon></up-cell></up-cell-group></view></scroll-view></block><slot a:else/></view>
|
||||
121
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-dropdown-item/u-dropdown-item.js
vendored
Normal file
121
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-dropdown-item/u-dropdown-item.js
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_components_uDropdownItem_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-item",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uDropdownItem_props.props],
|
||||
options: {
|
||||
styleIsolation: "shared"
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
active: false,
|
||||
// 当前项是否处于展开状态
|
||||
activeColor: "#2979ff",
|
||||
// 激活时左边文字和右边对勾图标的颜色
|
||||
inactiveColor: "#606266"
|
||||
// 未激活时左边文字和右边对勾图标的颜色
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 监听props是否发生了变化,有些值需要传递给父组件u-dropdown,无法双向绑定
|
||||
propsChange() {
|
||||
return `${this.title}-${this.disabled}`;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
propsChange(n) {
|
||||
if (this.parent)
|
||||
this.parent.init();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.parent = false;
|
||||
},
|
||||
emits: ["update:modelValue", "change"],
|
||||
methods: {
|
||||
addUnit: uni_modules_uviewPlus_libs_function_index.addUnit,
|
||||
init() {
|
||||
let parent = uni_modules_uviewPlus_libs_function_index.$parent.call(this, "u-dropdown");
|
||||
if (parent) {
|
||||
this.parent = parent;
|
||||
this.activeColor = parent.activeColor;
|
||||
this.inactiveColor = parent.inactiveColor;
|
||||
let exist = parent.children.find((val) => {
|
||||
return this === val;
|
||||
});
|
||||
if (!exist)
|
||||
parent.children.push(this);
|
||||
if (parent.children.length == 1)
|
||||
this.active = true;
|
||||
parent.menuList.push({
|
||||
title: this.title,
|
||||
disabled: this.disabled
|
||||
});
|
||||
}
|
||||
},
|
||||
// cell被点击
|
||||
cellClick(value) {
|
||||
this.$emit("update:modelValue", value);
|
||||
this.parent.close();
|
||||
this.$emit("change", value);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
|
||||
const _easycom_up_cell2 = common_vendor.resolveComponent("up-cell");
|
||||
const _easycom_up_cell_group2 = common_vendor.resolveComponent("up-cell-group");
|
||||
(_easycom_up_icon2 + _easycom_up_cell2 + _easycom_up_cell_group2)();
|
||||
}
|
||||
const _easycom_up_icon = () => "../u-icon/u-icon.js";
|
||||
const _easycom_up_cell = () => "../u-cell/u-cell.js";
|
||||
const _easycom_up_cell_group = () => "../u-cell-group/u-cell-group.js";
|
||||
if (!Math) {
|
||||
(_easycom_up_icon + _easycom_up_cell + _easycom_up_cell_group)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: $data.active
|
||||
}, $data.active ? common_vendor.e({
|
||||
b: !_ctx.$slots.default && !_ctx.$slots.$default
|
||||
}, !_ctx.$slots.default && !_ctx.$slots.$default ? {
|
||||
c: common_vendor.f(_ctx.options, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: _ctx.modelValue == item.value
|
||||
}, _ctx.modelValue == item.value ? {
|
||||
b: "2ab01489-2-" + i0 + "," + ("2ab01489-1-" + i0),
|
||||
c: common_vendor.p({
|
||||
name: "checkbox-mark",
|
||||
color: $data.activeColor,
|
||||
size: "32"
|
||||
})
|
||||
} : {}, {
|
||||
d: common_vendor.o(($event) => $options.cellClick(item.value)),
|
||||
e: index,
|
||||
f: "2ab01489-1-" + i0 + ",2ab01489-0",
|
||||
g: common_vendor.p({
|
||||
arrow: false,
|
||||
title: item.label,
|
||||
["title-style"]: {
|
||||
color: _ctx.modelValue == item.value ? $data.activeColor : $data.inactiveColor
|
||||
}
|
||||
})
|
||||
});
|
||||
}),
|
||||
d: $options.addUnit(_ctx.height)
|
||||
} : {}, {
|
||||
e: common_vendor.o(() => {
|
||||
}),
|
||||
f: common_vendor.o(() => {
|
||||
})
|
||||
}) : {});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2ab01489"]]);
|
||||
my.createComponent(Component);
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "shared",
|
||||
"usingComponents": {
|
||||
"up-icon": "../u-icon/u-icon",
|
||||
"up-cell": "../u-cell/u-cell",
|
||||
"up-cell-group": "../u-cell-group/u-cell-group"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user