import DividerEL from 'element-ui/lib/divider';

const Divider = {
  functional: true,
  name: DividerEL.name,
  props: {
    type: {
      type: String,
      default: 'solid',
      validator(val) {
        return ['solid', 'dashed'].indexOf(val) !== -1;
      }
    },
    ...DividerEL.props
  },
  render: function(h, context) {
    let _context = context;
    if (context.props.type === 'dashed') {
      _context.data.staticClass = `${context.data.staticClass ? context.data.staticClass + ' ' : ''}el-divider--dashed`;
    }
    // console.log(context);
    return h(
      DividerEL,
      {
        ..._context.data,
        props: _context.props
      },
      _context.children
    );
  }
};

Divider.install = function(Vue) {
  Vue.component(Divider.name, Divider);
};

export default Divider;
