import CipDropdown from '../../cip-dropdown'
import { ElDropdownItem, ElDropdownMenu } from 'element-plus'
export default {
  props: { modelValue: String },
  emits: ['update:modelValue'],
  setup (props, { emit }) {
    const layoutOptions = ['left', 'left-2', 'top', 'top-left']
    const handlerCommand = (val) => {
      emit('update:modelValue', val)
    }
    return () => <CipDropdown style={'height: 100%'} onCommand={(val) => handlerCommand(val)} popperClass='cip-nav-layout'>
      {{
        default: () => `${props.modelValue}`,
        dropdown: () => <ElDropdownMenu >
          {layoutOptions.map(option => <ElDropdownItem key={option} command={option}>{option}</ElDropdownItem>)}
        </ElDropdownMenu>
      }}
    </CipDropdown>
  }
}
