前端ai工具v0使用配置

news/2024/10/23 10:55:43/文章来源:https://www.cnblogs.com/qinLiCode/p/18495897

资料

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><divclass="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"><divclass="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-400focus:outline-none focus:border-purple-500 focus:ring-1 focus:ring-purple-500transition 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-400focus:outline-none focus:border-purple-500 focus:ring-1 focus:ring-purple-500transition duration-150 ease-in-out" placeholder="••••••••"></div><div v-if="!isLogin"><label for="confirmPassword" class="block text-sm font-medium text-gray-700">ConfirmPassword</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-400focus:outline-none focus:border-purple-500 focus:ring-1 focus:ring-purple-500transition 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><divclass="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.valueemail.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 = truemessage.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>

效果展示

效果展示

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/819556.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ERP开源项目Odoo

Odoo Odoo 的全称是 On Demand Open Object。名称反映了 Odoo 的起源和核心理念: •On Demand:代表 Odoo 作为一个按需使用的系统,可以根据企业的需要定制和部署各种模块。 •Open Object:强调 Odoo 是一个开源项目,允许用户访问和修改其源代码,以便根据具体业务需求进行…

2024.10.23 鲜花

基础数据结构进阶恋ひ恋ふ縁 诚、意地の悪い神の所业か? 奇迹?縁?袂触合う不思议 花ひとひら揺れて 不意に宿ってた うなじ解いてく春风 戯れはそこそこに 恋手ほどきしてくだしゃんせ 汤気にほんのり頬染て 夜风に愿ふ …いざ!!蝶と舞ひ花となりて 衣を乱して祓いましょう…

使用EasyExcel实现导出excel文件时生成多级下拉选

前言 公司有个需求本来只涉及到两个下拉选项,后面就想能不能实现多个下拉选,当然我这里说的多个下拉选是联动的,比如我省、地市、区县这种。 实现步骤 1、添加EasyExcel的Maven依赖<dependency><groupId>com.alibaba</groupId><artifactId>easyexce…

【运维自动化-作业平台】如何快速执行脚本和分发文件

脚本执行和文件分发是作业平台最基本、最核心的两个原子功能,主要分页面快速执行和作业里步骤引用,使用逻辑一样,一起来看看具体如何使用快速执行脚本 核心实现原理就是基于gse的命令管道,把脚本内容以WebPortal的方式透传到目标服务器进行执行,可以页面输入脚本也可以引用…

CMDB平台(进阶篇):企业级CMDB的高阶教程

企业IT架构日益复杂,配置项数量庞大且关系错综复杂。为了有效管理这些配置项,确保IT服务的稳定性和可靠性,配置管理数据库(Configuration Management Database,简称CMDB)系统应运而生。本文将深入探讨企业搭建CMDB系统所需具备的要素,以及实践路径,旨在为企业提供有益的…

U 盘

目录1 USB 大容量存储设备2 设备描述符3 字符串描述符4 配置描述符集合4.1 配置描述符4.2 接口描述符4.3 端点描述符6 类特殊请求6.1 Get Max LUN 请求6.2 Bulk-Only Mass Storage Reset 请求7 Bulk-Only 传输协议的数据流模型7.1 CBW 的结构7.2 CSW 的结构7.3 对批量数据的处理…

manim边做边学--复数平面

所谓复数平面,就是一种二维坐标系统,用于几何表示复数的场景,其中横轴代表实部,纵轴代表虚部。 每个点对应一个唯一的复数,反之亦然,这种表示方法使得复数的加法、乘法等运算可以通过直观的图形变换来理解。 ComplexPlane是Manim库中用于处理复数平面的类。 它不仅提供了…

3185. 构成整天的下标对数目 II

给你一个整数数组 hours,表示以 小时 为单位的时间,返回一个整数,表示满足 i < j 且 hours[i] + hours[j] 构成 整天 的下标对 i, j 的数目。 整天 定义为时间持续时间是 24 小时的 整数倍 。 例如,1 天是 24 小时,2 天是 48 小时,3 天是 72 小时,以此类推。 示例 1:…

使用dbeaver导出数据csv格式要求

1.分隔符改成使用\t, 默认的会导致数字不对2.下面也要修改下,不然会出现列和值对不上情况

通过集成平台实现聚水潭销售出库单与金蝶云星辰V2的无缝对接

PACKAGE-聚水潭销售出库单对接销售出库单-1 在企业信息化系统的集成过程中,数据的高效、准确传输至关重要。本文将分享一个具体的技术案例:如何通过轻易云数据集成平台,将聚水潭奇门的数据无缝对接到金蝶云星辰V2,实现销售出库单的自动化处理。 本次集成方案命名为“PACKAG…