Vue <script setup> compiler macro for providing props default values when using type-based defineProps declaration.
<script setup>
defineProps
Example usage:
withDefaults(defineProps<{ size?: number labels?: string[]}>(), { size: 3, labels: () => ['default label']}) Copy
withDefaults(defineProps<{ size?: number labels?: string[]}>(), { size: 3, labels: () => ['default label']})
This is only usable inside <script setup>, is compiled away in the output and should not be actually called at runtime.
https://vuejs.org/guide/typescript/composition-api.html#typing-component-props
Vue
<script setup>
compiler macro for providing props default values when using type-baseddefineProps
declaration.Example usage:
This is only usable inside
<script setup>
, is compiled away in the output and should not be actually called at runtime.