Skip to content

scriptLang NPM Version

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

<script> 块设置默认语言。

TIP

<script setup> 转换为 <script setup lang="ts">.

FeaturesSupported
Vue 3
Nuxt 3
Vue 2
Volar Plugin

Options

ts
interface Options {
  /**
   * @default 'ts'
   */
  defaultLang?: 'ts' | 'tsx' | 'jsx' | string
}

Usage

vue
<script setup>
defineProps
<{
foo
: string
}>() </script>

Volar Configuration

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

贡献者

页面历史