scriptLang
稳定性:
实验性 ⚠️ 实验性功能,风险自负为 <script> 块设置默认语言。
TIP
把 <script setup> 转换为 <script setup lang="ts">.
| Features | Supported |
|---|---|
| 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
{
"vueCompilerOptions": {
"plugins": ["vue-macros/volar"],
"vueMacros": {
"scriptLang": {
"defaultLang": "ts",
},
},
},
}
Kevin Deng
zhiyuanzmj
Leo
Alex