【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'

大功告成!

相关推荐
吃西瓜的年年2 分钟前
react(四)
前端·javascript·react.js
阿凤2123 分钟前
后端返回数据流的格式
开发语言·前端·javascript·uniapp
懂懂tty32 分钟前
React Hooks原理
前端·react.js
00后程序员张33 分钟前
前端可视化大屏制作全指南:需求分析、技术选型与性能优化
前端·ios·性能优化·小程序·uni-app·iphone·需求分析
kyriewen37 分钟前
屎山代码拆不动?微前端来救场:一个应用变“乐高城堡”
前端·javascript·前端框架
@大迁世界39 分钟前
3月 React 圈又变天了
前端·javascript·react.js·前端框架·ecmascript
忆江南41 分钟前
# iOS 稳定性方向常见面试题与详解
前端
陆枫Larry43 分钟前
一次讲清楚 `Promise.finally()`:为什么“无论成功失败都要执行”该用它
前端
Momo__44 分钟前
被低估的 HTML 原生表单元素:dialog、datalist、meter、progress
前端
莹宝思密达1 小时前
【AI】chrome-dev-tools-mcp
前端·ai