其他分享
首页 > 其他分享> > Element Select 二次封装

Element Select 二次封装

作者:互联网

 

<script>
import { Select, Option } from 'element-ui'
export default {
  props: {
    options: {
      type: Array,
      default: () => [],
    },
    value: {},
  },
  render(h) {
    return h(
      Select,
      {
        on: this.$listeners,
        attrs: this.$attrs,
        props: {
          value: this.value,
        },
        scopedSlots: this.$scopedSlots,
      },
      this.options.map((op) =>
        h(Option, {
          props: {
            key: op.value,
            label: op.label,
            value: op.value,
          },
        }),
      ),
    )
  },
}
</script>

 

标签:封装,value,Element,attrs,props,scopedSlots,Select,op
来源: https://www.cnblogs.com/fenle/p/14328650.html