Skip to content

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

Open
Open
@niuyutian

Description

@niuyutian
注意这里mubutton file not exist 将这个文件引入改为引入ts即可
import MyButton from "./MyButton.ts"

// 你的答案
import { h, defineComponent } from "vue"

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions