/**
 * 右键菜单项
 * @author xiufu.wang
 */
import ElDropdownItem from 'mars-pro/packages/dropdown-item';

export default {
    name: 'ProContextmenuItem',
    componentName: 'ProContextmenuItem',
    inheritAttrs: false,
    components: {
        ElDropdownItem
    },
    props: {
        command: String,
        disabled:Boolean
    },
    methods: {
        handleClick() {
            if (this.disabled) { 
                return
            }
            this.$emit('handler', this.command)
        }
    },
    render() { 
        const _datas = {
            props: {
                disabled: this.disabled,
                ...this.$attrs,
            },
            attrs: {
                ...this.$attrs
            },
            'class': {
                'pro-contextmenu--item': true
            },
            nativeOn: {
                click: this.handleClick
            }
        }
        return (
            <ElDropdownItem {..._datas}>
                {this.$slots.default}
            </ElDropdownItem>
        )
    }
}