Vue 3组件,基于 Typed.js 创建打字动画。
简体中文 | English
# npm
npm install typed-vue3
# pnpm
pnpm add typed-vue3
# npm
yarn add typed-vue3
<template>
<TypedComponent :options="options" />
</template>
<script setup lang="ts">
import { TypedComponent, type TypedOptions } from "typed-vue3";
const options: TypedOptions = {
strings: ["云想衣裳花想容", "春风拂槛露华浓"]
};
</script>
<template>
<TypedComponent :options="options">
<span>李白白:</span><span class="typing" />
</TypedComponent>
</template>
<script setup lang="ts">
import { TypedComponent, type TypedOptions } from "typed-vue3";
const options: TypedOptions = {
strings: ["云想衣裳花想容,春风拂槛露华浓"],
typeSpeed: 50,
loop: true,
onComplete(self) {
console.log("onComplete", self);
}
};
</script>
已支持所有 Typed.js
的配置项
具体配置请查看 Typed.js