🌐 Nodejs.cn

JavaScript

如何在 JavaScript 中使用 shadcn-vue

这个项目及其组件都是用 TypeScript 编写的。我们也建议在你的项目中使用 TypeScript。

🌐 This project and the components are written in TypeScript. We recommend using TypeScript for your project as well.

然而,我们也提供组件的 JavaScript 版本。JavaScript 版本可以通过 cli 获得。

🌐 However we provide a JavaScript version of the components as well. The JavaScript version is available via the cli.

要选择退出 TypeScript,你可以在你的 components.json 文件中使用 typescript 标志。

🌐 To opt-out of TypeScript, you can use the typescript flag in your components.json file.

components.json
{
  "style": "default",
  "tailwind": {
    "config": "tailwind.config.js",
    "css": "src/app/globals.css",
    "baseColor": "zinc",
    "cssVariables": true
  },
  "typescript": false,
  "aliases": {
    "utils": "~/lib/utils",
    "components": "~/components"
  }
}

要配置导入别名,你可以使用以下 jsconfig.json

🌐 To configure import aliases, you can use the following jsconfig.json:

jsconfig.json
{
  "compilerOptions": {
    "paths": {
      "@/*": ["./*"]
    }
  }
}