Vue3炫酷动画库Vue Bits使用笔记

Vue3 集成动画库 Vue Bits

Vue Bits使用 jsrepo 的脚手架安装组件,官方文档中每个组件都有安装步骤。

一、全局安装 jsrepo

复制代码
npm install jsrepo -g

二、初始化项目 jsrepo

csharp 复制代码
npx jsrepo init https://vue-bits.dev/ui

三、完成第二步的配置选项后会在根目录生成一个jsrepo.json文件

json 复制代码
{
  "$schema": "https://unpkg.com/jsrepo@2.4.5/schemas/project-config.json",
  "repos": ["https://vue-bits.dev/ui"],
  "includeTests": false,
  "includeDocs": false,
  "watermark": true,
  "formatter": "prettier",
  "configFiles": {},
  "paths": {
    "*": "./src/blocks",
    "Animations": "./src/Animations",
    "Backgrounds": "./src/Backgrounds",
    "Components": "./src/Components",
    "TextAnimations": "./src/TextAnimations"
  }
}

四、使用安装需要的组件,以 SplitText 文本动画组件为例子

csharp 复制代码
npx jsrepo add https://vue-bits.dev/ui/TextAnimations/SplitText

执行命令后安装组件代码。在vue中使用(注意安装组件路径):

javascript 复制代码
<template>
  <SplitText
    text="Hello, GSAP!"
    class-name="text-2xl font-semibold text-center"
    :delay="100"
    :duration="0.6"
    ease="power3.out"
    split-type="chars"
    :from="{ opacity: 0, y: 40 }"
    :to="{ opacity: 1, y: 0 }"
    :threshold="0.1"
    root-margin="-100px"
    text-align="center"
    @animation-complete="handleAnimationComplete"
  />
</template>

<script setup>
  import SplitText from "./SplitText.vue";

  const handleAnimationComplete = () => {
    console.log('All letters have animated!');
  };
</script>
相关推荐
软件技术NINI10 分钟前
泉州html+css 4页
前端·javascript·css·html
再吃一根胡萝卜11 分钟前
OpenScreen:免费开源的录屏神器,做出专业级演示视频
前端
Cloud_Shy61812 分钟前
Python 数据分析基础入门:《Excel Python:飞速搞定数据分析与处理》学习笔记系列(第十一章 Python 包跟踪器 下篇)
前端·后端·python·数据分析·excel
kyriewen14 分钟前
我用AI把公司10万行代码屎山重构了,CTO看了代码后说:你提前转正
前端·javascript·ai编程
ttwuai16 分钟前
XYGo Admin 菜单与路由:Vue3 动态路由 + GoFrame 权限菜单的完整实现方案
前端·vue·后台框架
程序员码歌25 分钟前
OpenSpec 到 Superpowers:AI 编码从说清到做对
android·前端·人工智能
爱编程的小新☆25 分钟前
LangGraph4j工作流框架
前端·数据库·ai·langchain·langgraph4j
北风toto37 分钟前
为什么 IntelliJ IDEA Community 无法开发 Vue?——附解决方案
java·vue.js·intellij-idea
@PHARAOH41 分钟前
HOW - 构建一个轻量前后端一体服务
前端·微服务·服务端