UNPKG

@vrx-arco/pro-components

Version:

<p align="center"> <img src="https://vrx-arco.github.io/arco-design-pro/favicon.svg" width="200" height="250"> </p>

64 lines (63 loc) 1.71 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const vue = require("vue"); const webVue = require("@arco-design/web-vue"); const use = require("@vrx-arco/use"); const _var = require("../style/var.js"); function _isSlot(s) { return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s); } const AvatarDropDown = /* @__PURE__ */ vue.defineComponent({ name: "vrx-arco-avatar-drop-down", props: { /** * 用户名 */ username: String, /** * 下拉框选项 */ dropdown: { type: Array, default: () => [] } }, emits: ["select"], setup: (props, { slots, emit }) => { const { bemClass } = _var.style("avatar-dropdown"); const handleSelect = (select) => { emit("select", select); }; return () => { const { dropdown } = props; const username = use.propsSlot(slots, props, "username", "default"); return vue.createVNode(webVue.Dropdown, { "onSelect": handleSelect }, { default: () => [vue.createVNode(webVue.Avatar, { "class": bemClass() }, _isSlot(username) ? username : { default: () => [username] })], content: () => { var _a; return ((_a = slots.content) == null ? void 0 : _a.call(slots)) || dropdown.map((item) => vue.createVNode(webVue.Dropdown.Option, { "key": item.value, "value": item.value, "disabled": item.disabled }, { default: () => [item.title] })); } }); }; } }); exports.AvatarDropDown = AvatarDropDown;