zoujiandong 43abd1f3d6 222
2025-07-30 13:58:39 +08:00

119 lines
3.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
const common_vendor = require("../../../../common/vendor.js");
const _sfc_main = {
name: "u-dropdown-item",
mixins: [common_vendor.mpMixin, common_vendor.mixin, common_vendor.props$11],
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: common_vendor.addUnit,
init() {
let parent = common_vendor.$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: "243060d4-2-" + i0 + "," + ("243060d4-1-" + i0),
c: common_vendor.p({
name: "checkbox-mark",
color: $data.activeColor,
size: "32"
})
} : {}, {
d: common_vendor.o(($event) => $options.cellClick(item.value), index),
e: index,
f: "243060d4-1-" + i0 + ",243060d4-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-243060d4"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/node-modules/uview-plus/components/u-dropdown-item/u-dropdown-item.js.map