dev-aid/vue/cli.md
2024-08-23 09:46:33 +08:00

80 lines
1.1 KiB
Markdown

<h1>
Vite
<h3>构建项目</h3>
</h1>
### 创建项目
```bash
npm create vite@latest
# OR
yarn create vite
```
### 使用模板创建项目
```bash
# npm 6.x
npm create vite@latest my-vue-app --template vue
# npm 7+, extra double-dash is needed:
npm create vite@latest my-vue-app -- --template vue
# yarn
yarn create vite my-vue-app --template vue
# pnpm
pnpm create vite my-vue-app --template vue
```
<h1>
Vue CLI
<h3>构建项目</h3>
</h1>
### 安装
```bash
npm install -g @vue/cli
# OR
yarn global add @vue/cli
```
### 创建项目
```bash
vue create hello-world
```
### 安装 TailWind CSS
```bash
# 安装依赖
yarn add -D tailwindcss@latest postcss@latest autoprefixer@latest
# 生成配置文件
npx tailwindcss init -p
# 修改配置文件 tailwind.config.js
module.exports = {
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
theme: {
extend: {},
},
plugins: [],
}
# 创建 index.css
@tailwind base;
@tailwind components;
@tailwind utilities;
# main.js 引入 index.css
```
### 安装公司内部的 npm 包
```bash
pnpm add @yhsoft/web-fabric --registry=https://npm.yinghuasoft.com
```