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

大功告成!

相关推荐
用户9714171814271 天前
vite项目开发环境启动白屏
前端
Highcharts.js1 天前
Highcharts客户端导出使用文档说明|图表导出模块讲解
前端·javascript·pdf·highcharts·图表导出
上山打牛1 天前
cornerstone3D 通过二进制渲染影像
前端
一只小阿乐1 天前
react路由中使用context
前端·javascript·react.js·context 上下文
Hilaku1 天前
一周狂揽40K+ Star⭐ 的 Pretext 到底有多变态?
前端·javascript·html
Southern Wind1 天前
AI Skill Server 动态技能中台
前端·后端·mysql·node.js
锦木烁光1 天前
多端项目太乱?我是这样用 Monorepo 重构的
前端·架构
上山打牛1 天前
cornerstone3D基本使用
前端
阿鑫_9961 天前
通用-Nvm基础知识
前端
银河系的一束光1 天前
旅游网站html、css、bootstrap
css·html·旅游