欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue3?tailwindcss的使用教程

 更新時間:2023年08月22日 14:12:53   作者:逆風(fēng)優(yōu)雅  
Tailwind是由Adam Wathan領(lǐng)導(dǎo)的TailwindLabs開發(fā)的 CSS 框架,這篇文章主要介紹了vue3?tailwindcss的使用,需要的朋友可以參考下

Tailwind CSS

Tailwind是由Adam Wathan領(lǐng)導(dǎo)的TailwindLabs開發(fā)的 CSS 框架。

實用類

Tailwind 附帶了大量實用類。將它們組合起來并調(diào)整樣式是使用 Tailwind 進(jìn)行樣式設(shè)置的一大特點。實用類以相當(dāng)小的單元準(zhǔn)備,因此大多數(shù)樣式都可以通過僅組合實用類來實現(xiàn)。

Tailwind 實用類用 CSS 寫
text-red-50color: rgb(254 226 226)
text-red-100color: rgb(254 202 202)
text-red-200color: rgb(252 165 165)
text-red-300color: rgb(254 226 226)
text-red-400color: rgb(248 113 113)
text-red-500color: rgb(239 68 68)
text-red-600color: rgb(220 38 38)
text-red-700color: rgb(185 28 28)
text-red-800color: rgb(153 27 27)
text-red-900color: rgb(127 29 29)

有這么多的類,你可能會認(rèn)為很難記住這些類,但正如你在上面看到的,text-red-50 Tailwind 的實用類名稱是這樣命名的,這樣你就可以很容易地想象要應(yīng)用的樣式。

vue3 tailwindcss的使用

首先安裝依賴:

npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
npm i -D unocss

然后vite.config.ts中 引入

 
import Unocss from 'unocss/vite'
export default defineConfig({
    plugins: [
        Unocss(),
    ],
})

終端執(zhí)行:

npx tailwindcss init -p

會在項目根目錄下面生成兩個文件

 tailwind.config.js

module.exports = {
    content: [
        "./index.html",
        "./src/**/*.{vue,js,ts,jsx,tsx}",
    ],
    theme: {
        extend: {},
    },
    plugins: [],
}

postcss.config.js

module.exports = {
    plugins: {
        tailwindcss: {},
        autoprefixer: {},
    },
}

完成以上步驟就可以在標(biāo)簽中直接使用 tailwind 提供的相關(guān)類名了。

VScode 安裝插件 Tailwind CSS IntelliSense 會有代碼提示

到此這篇關(guān)于vue3 tailwindcss的使用的文章就介紹到這了,更多相關(guān)vue3 tailwindcss使用內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論