Skip to content

exportProps NPM Version

Stability: experimental ⚠️ Experimental feature, use at your risk

Svelte-like Declaring props for Vue.

FeaturesSupported
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

tsconfig.json
jsonc
{
  "vueCompilerOptions": {
    "plugins": ["unplugin-vue-macros/volar"],
    "vueMacros": {
      "exportProps": true,
    },
  },
}

Contributors

Changelog