跳到正文

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 ​

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

贡献者

页面历史

用 ❤️ 发电