This is an old revision of the document!


bare bone

import { computed, defineComponent, type PropType } from 'vue'

const props = {
  modelValue: {
    type: Object as PropType<__MODEL_TYPE__>,
    default: () => ({})
  },
  'onUpdate:modelValue': {
    type: Function as PropType<(val: __MODEL_TYPE__) => void>
  }
}

export default defineComponent({
  props,
  setup(props) {
    const { 'onUpdate:modelValue': updateModelValue } = props
    const modelValue = computed({
      get() {
        return props.modelValue
      },
      set(val) {
        updateModelValue?.(val)
      }
    })
    return () => <></>
  }
})

import { defineComponent } from 'vue'

export default defineComponent(
  <T,>(props: { message: T }) => {
    return () => <></>
  },
  {
    props: []
  }
)

import { defineComponent } from 'vue'

export default defineComponent({
  setup() {
    return () => <></>
  }
})

tsx component

tsx table

tsx _form

tsx add

  • snippets/vue.1757405376.txt.gz
  • Last modified: 2025/09/09 08:09
  • by lingao