下载相关依赖
pnpm add tailwindcss postcss autoprefixer -D;
初始化相关配置文件
npx tailwindcss init -p;
在 postcss. config. js 添加
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
在tailwind. config. js 添加
/** @type {import ('tailwindcss'). Config} */这行也要添加
module. exports = {
content: ['./index. html', './src/**/*.{vue, js, ts, jsx, tsx}'],
theme: {
extend: {},
},
plugins: [],
}
最后, 在项目的全局样式文件添加
@tailwind base;
@tailwind components;
@tailwind utilities;
如:
觉得有用的话, 就给博主点个赞吧