当前位置: 首页 > news >正文

Vue学习记录之十八 Vue3集成tailwindcss

tailwindcss介绍

号称只需书写 HTML 代码,无需书写 CSS,即可快速构建美观的网站。tailwindcss 其实就是一个css框架,可以选择你需要的样式,快速构建自己的网站。
官方地址:
https://www.tailwindcss.cn/

一、安装

pnpm create vite@latest demo1

二、安装tailwindcss

# 安装 Tailwind CSS 及其所需的依赖
npm install -D tailwindcss postcss autoprefixer

同时在vs中搜索tailwind 插件
在这里插入图片描述

三、配置模板文件路径

先生成配置文件

npx tailwindcss init -p

在tailwind.config.js添加代码

/** @type {import('tailwindcss').Config} */
export default {// 在content中添加 './index.html','./src/**/*.{vue,js,ts,jsx,tsx}'content: ['./index.html','./src/**/*.{vue,js,ts,jsx,tsx}'],theme: {extend: {},},plugins: [],
}

四、在src下新建一个index.css,内容如下:

@tailwind base;
@tailwind components;
@tailwind utilities;

然后在main.ts中引入index.css

import './index.css'

五、使用

在App.vue中加入下面代码

<template><div class="w-screen h-screen bg-red-600 flex justify-center items-center text-8xl text-slate-200">hello tailwindcss</div>
</template>
<script setup lang='ts'>
import { ref,reactive } from 'vue'</script>
<style scoped></style>

在这里插入图片描述


http://www.mrgr.cn/news/55577.html

相关文章:

  • Linux运维篇-误操作已经做了pv的磁盘导致pv异常
  • Imagic: Text-Based Real Image Editing with Diffusion Models
  • 3.1.1ReactOS系统中搜索给定长度的空间地址区间函数的实现
  • Verilator——最简单、最细节上手教程
  • 【JAVA】第一张_Java基础语法
  • 内网穿透很简单
  • 深入理解Python函数
  • Unity 同项目多开
  • ES2017 新特性 (Async和await)
  • Linux -- 进程间通信、初识匿名管道
  • 企业注销后微信商户平台账号注销商户主体的详细操作流程及解答
  • Grid Designer 网格设计师
  • Yolo目标检测:Yolo v1简介
  • tftpd.exe源代码分析第一篇get 2.txt
  • 头歌——人工智能(启发式搜索算法)
  • Linux安装Python解释器
  • ThinkPHP3.1框架.zip
  • 特种作业操作烟花爆竹试题分享
  • 尚硅谷redis第144节 淘汰策略及使用建议 答疑
  • Nature 正刊丨相纯χ-Fe5C2高效转化合成气为线性α-烯烃
  • upload-labs靶场Pass-10
  • PH47代码框架软件二次开发极简教程
  • HarmonyOS开发 - ohpm环境变量配置
  • JAVA课设-图书指引系统(前后端分离)
  • 期权懂|股票下跌时可以使用期权止损吗?
  • 绝对差值的和