资料

ai工具Vo

Installation - Tailwind CSS

以vue3 + sass为例,配置如下

安装tailwindcss

npm install -D tailwindcss
npx tailwindcss init

安装依赖(可选)

npm install lucide-vue-next

更新 tailwind.config.js

/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./index.html",
"./src/**/*.{vue,js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}

主CSS文件(通常是 src/assets/main.css,没有就创建一个)中添加Tailwind的指令:

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

确保main.css生效

main.ts 或者 main.js引入main.css

import './assets/main.css'

配置vite.config.ts 或者js

import tailwindcss from 'tailwindcss'

示例代码

<template>
<div
class="min-h-screen bg-gradient-to-br from-purple-400 via-pink-500 to-red-500 flex items-center justify-center p-4">
<div class="bg-white w-full max-w-md rounded-2xl shadow-2xl overflow-hidden">
<div class="p-8">
<div class="text-center mb-8">
<div
class="inline-block p-4 rounded-full bg-gradient-to-r from-purple-500 to-pink-500 text-white mb-4">
<UserIcon class="h-8 w-8" />
</div>
<h2 class="text-3xl font-extrabold text-gray-900">{{ isLogin ? 'Welcome Back' : 'Create Account' }}
</h2>
<p class="mt-2 text-sm text-gray-600">
{{ isLogin ? 'Sign in to your account' : 'Sign up for a new account' }}
</p>
</div> <form @submit.prevent="handleSubmit" class="space-y-6">
<div>
<label for="email" class="block text-sm font-medium text-gray-700">Email</label>
<input type="email" id="email" v-model="email" required class="mt-1 block w-full px-3 py-2 bg-gray-100 border border-gray-300 rounded-md text-sm shadow-sm placeholder-gray-400
focus:outline-none focus:border-purple-500 focus:ring-1 focus:ring-purple-500
transition duration-150 ease-in-out" placeholder="you@example.com">
</div> <div>
<label for="password" class="block text-sm font-medium text-gray-700">Password</label>
<input type="password" id="password" v-model="password" required class="mt-1 block w-full px-3 py-2 bg-gray-100 border border-gray-300 rounded-md text-sm shadow-sm placeholder-gray-400
focus:outline-none focus:border-purple-500 focus:ring-1 focus:ring-purple-500
transition duration-150 ease-in-out" placeholder="••••••••">
</div> <div v-if="!isLogin">
<label for="confirmPassword" class="block text-sm font-medium text-gray-700">Confirm
Password</label>
<input type="password" id="confirmPassword" v-model="confirmPassword" required class="mt-1 block w-full px-3 py-2 bg-gray-100 border border-gray-300 rounded-md text-sm shadow-sm placeholder-gray-400
focus:outline-none focus:border-purple-500 focus:ring-1 focus:ring-purple-500
transition duration-150 ease-in-out" placeholder="••••••••">
</div> <div>
<button type="submit"
class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 transition duration-150 ease-in-out"
:disabled="isLoading">
<Loader2Icon v-if="isLoading" class="animate-spin -ml-1 mr-3 h-5 w-5 text-white" />
{{ isLoading ? 'Processing...' : (isLogin ? 'Sign In' : 'Sign Up') }}
</button>
</div>
</form> <div class="mt-6">
<div class="relative">
<div class="absolute inset-0 flex items-center">
<div class="w-full border-t border-gray-300"></div>
</div>
<div class="relative flex justify-center text-sm">
<span class="px-2 bg-white text-gray-500">
Or continue with
</span>
</div>
</div> <div class="mt-6 grid grid-cols-3 gap-3">
<div>
<a href="#"
class="w-full inline-flex justify-center py-2 px-4 border border-gray-300 rounded-md shadow-sm bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
<GithubIcon class="h-5 w-5" />
</a>
</div>
<div>
<a href="#"
class="w-full inline-flex justify-center py-2 px-4 border border-gray-300 rounded-md shadow-sm bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
<TwitterIcon class="h-5 w-5 text-[#1DA1F2]" />
</a>
</div>
<div>
<a href="#"
class="w-full inline-flex justify-center py-2 px-4 border border-gray-300 rounded-md shadow-sm bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
<FacebookIcon class="h-5 w-5 text-[#4267B2]" />
</a>
</div>
</div>
</div>
</div> <div
class="px-8 py-4 bg-gray-50 border-t border-gray-200 flex flex-col sm:flex-row justify-between items-center">
<div class="text-sm text-gray-600">
{{ isLogin ? "Don't have an account?" : "Already have an account?" }}
</div>
<button @click="toggleForm"
class="mt-3 sm:mt-0 w-full sm:w-auto flex justify-center items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-purple-600 bg-white hover:bg-purple-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 transition duration-150 ease-in-out">
{{ isLogin ? 'Sign Up' : 'Sign In' }}
</button>
</div>
</div> <transition name="fade">
<div v-if="message" class="fixed bottom-4 right-4 p-4 rounded-md shadow-lg" :class="messageClass">
{{ message }}
</div>
</transition>
</div>
</template> <script setup>
import { ref, computed } from 'vue'
import { UserIcon, Loader2Icon, GithubIcon, TwitterIcon, FacebookIcon } from 'lucide-vue-next' const isLogin = ref(true)
const email = ref('')
const password = ref('')
const confirmPassword = ref('')
const isLoading = ref(false)
const message = ref('') const messageClass = computed(() => {
return {
'bg-green-100 text-green-800 border-green-300': message.value.includes('successful'),
'bg-red-100 text-red-800 border-red-300': message.value.includes('failed') || message.value.includes('match')
}
}) const toggleForm = () => {
isLogin.value = !isLogin.value
email.value = ''
password.value = ''
confirmPassword.value = ''
message.value = ''
} const handleSubmit = async () => {
if (!isLogin.value && password.value !== confirmPassword.value) {
message.value = 'Passwords do not match'
return
} isLoading.value = true
message.value = '' try {
// 这里应该是实际的API调用
await new Promise(resolve => setTimeout(resolve, 1500)) message.value = isLogin.value ? 'Login successful' : 'Registration successful' // 在实际应用中,这里应该处理登录/注册成功后的逻辑,比如重定向到仪表板页面
} catch (error) {
message.value = isLogin.value ? 'Login failed' : 'Registration failed'
} finally {
isLoading.value = false
}
}
</script> <style scoped>
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.5s ease;
} .fade-enter-from,
.fade-leave-to {
opacity: 0;
}
</style>

效果展示

前端ai工具v0使用配置的更多相关文章

  1. webstorm前端开发工具vue环境配置及运行项目

    1:webstorm的安装:2:node.js的安装3:安装Git4:vue-cli 安装前面两步就可以把项目启动了,安装Git主要是打开命令窗口,这样就可以用liunx命令了,原理跟cmd差不多 V ...

  2. 学习安装并配置前端自动化工具Gulp

    Gulp和所有Gulp插件都是基于nodeJs来运行的,因此在你的电脑上需要安装nodeJs,安装过程请移驾安装并配置前端自动化工具--grunt.安装完成后,通过运行cmd进入DOS命令窗口,如图: ...

  3. 前端构建工具之gulp的安装和配置

    在选择构建工具时,看到更多人推荐gulp,从此入了gulp的坑- 一.安装node环境 百度谷歌一下就有了,在终端中分别输入 node -v 和 npm -v,若显示node和npm的版本号则说明no ...

  4. 前端见微知著工具篇:Grunt实现自动化

    转载说明 本篇文章为转载文章,来源为[前端福利]用grunt搭建自动化的web前端开发环境-完整教程,之所以转载,是因为本文写的太详细了,我很想自己来写,但是发现跳不出这篇文章的圈子,因为写的详尽,所 ...

  5. 前端构建工具之gulp(一)「图片压缩」

    前端构建工具之gulp(一)「图片压缩」 已经很久没有写过博客了,现下终于事情少了,开始写博吧 今天网站要做一些优化:图片压缩,资源合并等 以前一直使用百度的FIS工具,但是FIS还没有提供图片压缩的 ...

  6. 前端构建工具之gulp_常用插件

    gulp常用插件的使用 今天来看看一下gulp的常用插件的使用 就像gruntjs需要一个Gruntfile.js文件一样,gulp也需要一个文件作为它的主文件,在gulp中这个文件叫做gulpfil ...

  7. 前端自动化工具gulp自动添加版本号

    之前,我介绍了学习安装并配置前端自动化工具Gulp,觉得gulp确实比grunt的配置简单很多,于是我决定再深入学习一下gulp,就去网上查了资料,发现gulp还可以自动添加版本号,这个功能就为我平时 ...

  8. 前端构建工具gulpjs的使用介绍及技巧

    gulpjs是一个前端构建工具,与gruntjs相比,gulpjs无需写一大堆繁杂的配置参数,API也非常简单,学习起来很容易,而且gulpjs使用的是nodejs中stream来读取和操作数据,其速 ...

  9. 前端构建工具gulp使用

    前端自动化流程工具,用来合并文件,压缩等. Gulp官网 http://gulpjs.com/ Gulp中文网 http://www.gulpjs.com.cn/ Gulp中文文档 https://g ...

  10. 前端模块化工具-webpack

    详解前端模块化工具-webpack webpack是一个module bundler,抛开博大精深的汉字问题,我们暂且管他叫'模块管理工具'.随着js能做的事情越来越多,浏览器.服务器,js似乎无处不 ...

随机推荐

  1. 常用的MySQL备份/还原 的方法

    mysql备份数据库 mysql备份单个数据库 #mysql备份某个库格式: mysqldump -h主机名 -P端口 -u用户名 -p"密码" --database 数据库名 & ...

  2. Pinely Round 4 (Div. 1 + Div. 2)

    题目链接:Pinely Round 4 (Div. 1 + Div. 2) 总结:被B卡了一年. A. Maximize the Last Element tag:模拟 Description:给定一 ...

  3. 3. 使用sql查询csv/json文件内容,还能关联查询?

    1. 简介 我们在前面的文章提到了calcite可以支持文件系统的数据源适配, 其实官方已经提供了相应的能力, 其支持csv和json的查询适配, 废话不多说, 直接展示. 2. Maven < ...

  4. 服务器通用背板管理(UBM)实现

    本文分享自天翼云开发者社区<服务器通用背板管理(UBM)实现>,作者: 乘风 一 UBM概述 通过SGPIO 进行 SAS 和 SATA 背板管理的 SCSI 机箱服务 (SES) 标准于 ...

  5. 定制化训练DeepSeek模型:LoAR、COT推理与SFT技术应用

    DeepSeek-R1 模型微调系列 DeepSeek-R1 模型微调系列一. 前言介绍本文内容:1.1 项目背景1.2 LoRA和 QLoRA 简介1.3 LLaMA 架构和 Qwen 架构LLaM ...

  6. 新塘M051 关于 System Tick设置,3种方法操作

    关于 System Tick设置,给出3种方法,学习并确认OK: 使用 M051BSPv3.01.001版本 一.使用函数CLK_EnableSysTick() 1 //Enable System T ...

  7. QT5笔记:7. 自定义类、自定义信号及类的元对象信息

    自定义的QPerson类,需要继承 QObject类 qperson.h头文件 #ifndef QPERSON_H #define QPERSON_H #include <QObject> ...

  8. Informatica - [01] 概述

    题记部分 001 || 概述   Informatica 是一家全球领先的数据集成和数据管理解决方案提供商,致力于为客户提供具有强大的元数据管理.数据集成和个性化分析递送功能.Informatica的 ...

  9. 前端跨域方案-跨域请求代理(asp.net handler)

    现在技术开发偏向于使用统一的接口处理浏览器或者app的http请求. 大家都知道因为浏览器的同源策略的原因 js直接请求webapi 接口会有一些问题,即使做好服务器端的配置 同样会有不少的 问题   ...

  10. 【Abaqus】Composite Layup建模

    abaqus 的3个复合材料建模途径: 传统的material->section->orientation->step->job的建模方式 Composite Layup建模方 ...