安装Tailwindcss
npm install -D tailwindcss postcss autoprefixer
生成 tailwind.conf.cjs
npx tailwindcss init -p
安装daisyui和daisyui react
npm i daisyui react-daisyui
taiwind.config.cjs
/** @type {import('tailwindcss').Config} */ module.exports = { content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'], theme: { extend: {}, }, plugins: [require('daisyui')], }
设置主题 index.html
<!DOCTYPE html> <html lang="en" data-theme="light"> ...