option-item.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. require('../../../hooks/index.js');
  5. var useOption = require('./useOption.js');
  6. var defaults = require('./defaults.js');
  7. var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
  8. var index = require('../../../hooks/use-namespace/index.js');
  9. const _sfc_main = vue.defineComponent({
  10. props: defaults.OptionProps,
  11. emits: ["select", "hover"],
  12. setup(props, { emit }) {
  13. const ns = index.useNamespace("select");
  14. const { hoverItem, selectOptionClick } = useOption.useOption(props, { emit });
  15. return {
  16. ns,
  17. hoverItem,
  18. selectOptionClick
  19. };
  20. }
  21. });
  22. const _hoisted_1 = ["aria-selected"];
  23. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  24. return vue.openBlock(), vue.createElementBlock("li", {
  25. "aria-selected": _ctx.selected,
  26. style: vue.normalizeStyle(_ctx.style),
  27. class: vue.normalizeClass([
  28. _ctx.ns.be("dropdown", "option-item"),
  29. _ctx.ns.is("selected", _ctx.selected),
  30. _ctx.ns.is("disabled", _ctx.disabled),
  31. _ctx.ns.is("created", _ctx.created),
  32. { hover: _ctx.hovering }
  33. ]),
  34. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  35. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  36. }, [
  37. vue.renderSlot(_ctx.$slots, "default", {
  38. item: _ctx.item,
  39. index: _ctx.index,
  40. disabled: _ctx.disabled
  41. }, () => [
  42. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.item.label), 1)
  43. ])
  44. ], 46, _hoisted_1);
  45. }
  46. var OptionItem = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select-v2/src/option-item.vue"]]);
  47. exports["default"] = OptionItem;
  48. //# sourceMappingURL=option-item.js.map