Skip to content

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

Open
Open
@sly3464

Description

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

export default defineComponent({
  name: 'MyButton',
  props: {
    disabled: Boolean
  },

  render() {
    const customClick = () => {
      this.$emit('custom-click')
    }
    return h(
      'button',
      {
        disabled: this.$props.disabled,
        onClick: customClick
      },
      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