Skip to content

exportProps NPM Version

稳定性: 实验性 ⚠️ 实验性功能,风险自负

在 Vue 中使用 Svelte 风格声明 props

特性支持
Vue 3
Nuxt 3?
Vue 2
Volar Plugin

用法

使用导出语法来声明 props

vue
<script setup lang="ts">
export let 
foo
: string
export const
bar
: number = 1 // 带有默认值
</script>

Volar 配置

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

贡献者

The avatar of contributor named as Kevin Deng Kevin Deng
The avatar of contributor named as zhiyuanzmj zhiyuanzmj

页面历史