当前位置: 首页 > news >正文

广州建设外贸网站移动网站建设价格便宜

广州建设外贸网站,移动网站建设价格便宜,建网站买什么主机,网站提示宏Vite 1. 创建项目 使用 vite 创建一个新的 vue 项目。 如果你正在使用 JS 模板,需要存在 jsconfig.json 文件才能正确运行 CLI。 # npm 6.x npm create vitelatest my-vue-app --template vue-ts# npm 7, extra double-dash is needed: npm create vitelatest m…

Vite

1. 创建项目

使用 vite 创建一个新的 vue 项目。

如果你正在使用 JS 模板,需要存在 jsconfig.json 文件才能正确运行 CLI

# npm 6.x
npm create vite@latest my-vue-app --template vue-ts# npm 7+, extra double-dash is needed:
npm create vite@latest my-vue-app -- --template vue-ts

2. 添加 Tailwind 并配置

安装 tailwindcss 及其对等依赖项,然后生成 tailwind.config.js 并配置 postcss 插件。

npm install -D tailwindcss autoprefixer

如果你正在使用 postcss.config.js,则无需此更改。

vite.config.ts

import path from 'node:path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'import tailwind from 'tailwindcss'
import autoprefixer from 'autoprefixer'export default defineConfig({css: {postcss: {plugins: [tailwind(), autoprefixer()],},},plugins: [vue()],resolve: {alias: {'@': path.resolve(__dirname, './src'),},},
})

3. 编辑 tsconfig/jsconfig.json

如果您正在使用 TypeScript,则当前版本的 Vite 将配置分成三个文件,对 tsconfig.app.json 需要进行相同的更改。

将下面的代码添加到 tsconfig.json 或者 jsconfig.jsoncompilerOptions 中,之后你的应用就可以正确地解析路径。

{"compilerOptions": {// ..."baseUrl": ".","paths": {"@/*": ["./src/*"]}// ...}
}

4. 更新 vite.config.ts

将下面的代码添加到 vite.config.ts ,之后你的应用就可以正确地解析路径。

# 请正确导入路径
npm i -D @types/node
import path from 'node:path'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'import tailwind from 'tailwindcss'
import autoprefixer from 'autoprefixer'export default defineConfig({css: {postcss: {plugins: [tailwind(), autoprefixer()],},},plugins: [vue()],resolve: {alias: {'@': path.resolve(__dirname, './src'),},},
})

5. 删除默认的 Vite 样式

删除默认的 css 文件 ./src/style.css

6. 运行 CLI

运行 shadcn-vue 初始化命令创建你的项目:

npx shadcn-vue@latest init

7. 配置 components.json

在此,你将如同创建 Vue 项目一样回答一系列问题:

Would you like to use TypeScript (recommended)? no / yes
Which framework are you using? Vite / Nuxt / Laravel
Which style would you like to use? › Default
Which color would you like to use as base color? › Slate
Where is your tsconfig.json or jsconfig.json file? › ./tsconfig.json
Where is your global CSS file? › › src/assets/index.css
Do you want to use CSS variables for colors? › no / yes
Where is your tailwind.config.js located? › tailwind.config.js
Configure the import alias for components: › @/components
Configure the import alias for utils: › @/lib/utils
Write configuration to components.json. Proceed? > Y/n

8. 更新 main.ts

删除默认配置的 css 并添加 tailwind 样式 import './assets/index.css'

import { createApp } from 'vue'
- import './style.css'
import App from './App.vue'
+ import './assets/index.css'createApp(App).mount('#app')

9. 开始使用

你现在可以开始添加 shadcn-vue 组件到你的项目中去。

npx shadcn-vue@latest add button

这条命令将添加 Button 组件到你的项目中去。你可以这样使用:

<script setup lang="ts">
import { Button } from '@/components/ui/button'
</script><template><div><Button>Click me</Button></div>
</template>

http://www.yayakq.cn/news/870585/

相关文章:

  • 海外网站速度慢室内设计培训班排行榜
  • 丹阳网站建设价格北京市网站制作
  • 提供网站建设加工带有网页的建筑公司
  • 无锡营销型网站制作网站空间信息查询
  • 一个虚拟主机绑定2个网站广告推广话术
  • 微信网站开发教程android开发wordpress
  • 郑州模板建站系统wordpress安卓ios应用
  • asp网站做安全地方网站定位
  • 怎么添加网站内锚点旅游网站首页设计图片
  • 盘锦网站建设vhkeji网站百度无排名
  • 广东深圳广东深圳网站建设河源城乡规划建设局网站
  • 西部数据网站建设上海公司车牌本月价格
  • 网站运营单位是什么意思建设部网站诚信平台
  • 科讯cms 网站地图软件项目实施计划方案
  • 家具网站 模板涪陵做网站
  • 网站首页图片效果温州seo团队
  • 网站建设服务器毕业设计做网站做什么好
  • ps案例教程网站个人网站 网站名称
  • 网站建设项目投资测算聊城的网站制作公司
  • 宜兴网站开发晋江做任务的网站
  • app需要网站有哪些网站维护更新
  • 电商网站新闻怎么做WordPress中文king主题
  • 织梦摄影网站模板电视台网站建设报告
  • 怎么给网站备案40平米老板办公室布置
  • 决定网站打开的速度商业网站网址
  • 论文中网站数据如何做脚注旅游公司网站开发
  • 湖南省城乡建设厅网站查证网站首页布局
  • 动易如何做网站广州电子商务网站建设 v
  • 做平面设计去哪些网站找图六安市核酸检测结果查询
  • 绵阳网站建设怎么做公司网站备案条件