import { ElDropdown, ElIcon } from 'element-plus'
import { CaretBottom } from '@element-plus/icons-vue'
import './index.less'
export default {
  name: 'CipDropdown',
  props: {
    noArrow: Boolean
  },
  setup (props, { attrs, slots }) {
    return () => <ElDropdown>
      {{
        default: () => <div class={'cip-dropdown__title'}>
          {slots.default?.()}
          {(!attrs.disabled && !props.noArrow) && <ElIcon class={'cip-dropdown__icon'}>
            <CaretBottom />
          </ElIcon>}
        </div>,
        dropdown: () => slots.dropdown?.()
      }}
    </ElDropdown>
  }
}
