exportProps
Stability:
experimental
⚠️ Experimental feature, use at your riskSvelte-like Declaring props for Vue.
Features | Supported |
---|---|
Vue 3 | ✅ |
Nuxt 3 | ❓ |
Vue 2 | ✅ |
Volar Plugin | ✅ |
Pre-requisite
Reactivity Transform is required to use this feature, but it is enabled by default in Vue Macros.
export let
will be changed to defineModel
, which is supported in Vue 3.4+.
Usage
Using export syntax to declare props.
vue
<script setup lang="ts">
export let foo: string
export const bar: number = 1 // with default value
</script>
Volar Configuration
jsonc
{
"vueCompilerOptions": {
"plugins": ["unplugin-vue-macros/volar"],
"vueMacros": {
"exportProps": true,
},
},
}