【2024】使用Vuetifi搭建vue3+Ts项目,并使用tailwind.css

目录

只要跟着官方文档来就不会出错。

使用Vuetifi搭建项目

bash 复制代码
npm create vuetify

yarn create vuetify

pnpm create vuetify

bun create vuetify

在终端运行一个就行,之后就可以选配置了。

使用tailwind.css

先运行:

bash 复制代码
npm install -D tailwindcss postcss autoprefixer

再运行:

bash 复制代码
npx tailwindcss init -p

然后就会发现多了两个文件:

然后配置tailwind.config.js文件:

javascript 复制代码
/** @type {import('tailwindcss').Config} */
module.exports = {
  darkMode: "class",
  corePlugins: {
    preflight: false
  },
  content: ["./index.html", "./src/**/*.{vue,js,ts,jsx,tsx}"],
  theme: {
    extend: {
      colors: {
        bg_color: "var(--el-bg-color)",
        primary: "var(--el-color-primary)",
        primary_light_9: "var(--el-color-primary-light-9)",
        text_color_primary: "var(--el-text-color-primary)",
        text_color_regular: "var(--el-text-color-regular)",
        text_color_disabled: "var(--el-text-color-disabled)"
      }
    }
  }
};

在src目录下新建一个css文件,这里是index.css:

css 复制代码
@tailwind base;
@tailwind components;
@tailwind utilities;

然后在main.ts里面引入这个文件:

css 复制代码
import './index.css'

大功告成!

相关推荐
cypking3 分钟前
三、NestJS 开发实战文档-->集成 MySQL(TypeORM)
前端·数据库·mysql·adb·node.js
dreams_dream3 分钟前
Element UI菜单折叠后的el-menu-item属性无法修改问题解决
前端·vue
duanyuehuan4 分钟前
vueRouter重置路由
前端·javascript·vue.js
Misnearch10 分钟前
npm包-serve包使用
前端·npm·node.js
IT_陈寒15 分钟前
React 18 性能优化实战:5个被低估的Hooks用法让你的应用快30%
前端·人工智能·后端
阿珊和她的猫22 分钟前
页面停留时长埋点实现技术详解
开发语言·前端·javascript·ecmascript
chilavert31824 分钟前
技术演进中的开发沉思-275 AJax : Slider
前端·javascript·ajax·交互
梦65030 分钟前
基于 Vue3 + TypeScript 封装 UEditor 富文本编辑器组件
前端·vue.js·typescript
沛沛老爹31 分钟前
从Web开发到AI应用——用FastGPT构建实时问答系统
前端·人工智能·langchain·rag·advanced-rag
锥锋骚年31 分钟前
Vue 3 Vben Admin 框架的Mention提及组件
前端·javascript·vue.js