Add $defineProp
zhiyuanzmj opened this issue · comments
zhiyuanzmj commented
Clear and concise description of the problem
Add reactivity transform support to defineProp.
Suggested solution
<script setup lang="ts">
// Kevin's Edition
const foo = defineProp<string>()
const bar = $defineProp('bar', { default: 'bar', required: true })
const baz = $(defineProp('baz', { default: 'baz' }))
console.log(foo.value, bar, baz)
// Johnson's Edition
const foo = defineProp<string>()
const bar = $defineProp(() => 'bar', true)
const baz = $(defineProp('baz'))
console.log(foo.value, bar, baz)
</script>
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.