Skip to content

218 - 渲染函数[h()] #3126

@wangliang01

Description

@wangliang01
import { defineComponent, h } from "vue"

export default defineComponent({
  name: 'MyButton',
  props: {
    disabled: {
      type: Boolean
    }
  },
  emits: ['custom-click'],
  render() {
    return h('button', {
      disabled: this.$props.disabled,
      onClick: () => this.$emit('custom-click')
    }, this.$slots.default())
  }
})

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions