vue3 文字轮播打字机效果
实现效果
1.安装依赖
npm install @duskmoon/vue3-typed-js
2.html
<div class="title_left_1">
<Typed :options="options" class="typedClass">
<div class="typing"></div>
</Typed>
</div>
3.ts
<script setup lang="ts">
//引入
import { Typed } from "@duskmoon/vue3-typed-js";
import type { TypedOptions } from "@duskmoon/vue3-typed-js";
const options: TypedOptions = {
strings: ['你好!', 'Hello!', 'こんにちは!','Bonjour!','안녕하세요!','Hola!','Hallo!','Здравствуйте!','你好!','Ciao!','Olá!','Hej!','Γεια σου!','Merhaba!','Witaj!','مرحبا!','Ahoj!'],
// 是否循环
loop: true,
// 打字速度
typeSpeed: 100,
// 回退速度
backSpeed: 20,
};
</script>