Giter VIP home page Giter VIP logo

Comments (3)

selicens avatar selicens commented on September 26, 2024

Dropdown的overlay嘛

from ant-design-vue.

shihaocong avatar shihaocong commented on September 26, 2024

Dropdown的覆盖嘛

select的,select和Dropdown用的应该是通用的overlay吧

from ant-design-vue.

selicens avatar selicens commented on September 26, 2024

selec没有暴露overlay属性,这是dropdown的

const renderOverlay = () => {
  // rc-dropdown already can process the function of overlay, but we have check logic here.
  // So we need render the element to check and pass back to rc-dropdown.
  const overlay = props.overlay || slots.overlay?.();
  const overlayNode = Array.isArray(overlay) ? overlay[0] : overlay;


  if (!overlayNode) return null;
  const overlayProps = overlayNode.props || {};


  // Warning if use other mode
  devWarning(
    !overlayProps.mode || overlayProps.mode === 'vertical',
    'Dropdown',
    `mode="${overlayProps.mode}" is not supported for Dropdown's Menu.`,
  );


  // menu cannot be selectable in dropdown defaultly
  const { selectable = false, expandIcon = (overlayNode.children as any)?.expandIcon?.() } =
    overlayProps;


  const overlayNodeExpandIcon =
    typeof expandIcon !== 'undefined' && isValidElement(expandIcon) ? (
      expandIcon
    ) : (
      <span class={`${prefixCls.value}-menu-submenu-arrow`}>
        <RightOutlined class={`${prefixCls.value}-menu-submenu-arrow-icon`} />
      </span>
    );


  const fixedModeOverlay = isValidElement(overlayNode)
    ? cloneElement(overlayNode, {
        mode: 'vertical',
        selectable,
        expandIcon: () => overlayNodeExpandIcon,
      })
    : overlayNode;


  return fixedModeOverlay;
};

from ant-design-vue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.