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>

 

上一篇:Android 获取控件大小(Android版 Flutter LayoutBuilder)


下一篇:v-on="$listeners"和v-bind="$attrs"