Skip to content

StGhostText 组件

幽灵文本组件

注意事项

该组件会在挂载后,渲染到页面上时,执行文本出现动画,动画执行完成后会保持动画最后一帧的状态

组件示例

St Ghost Text Demo
示例代码
vue
<script setup lang="ts">
import {StGhostText} from "st-common-ui-vue3"
</script>

<template>
  <div class="ghost-text-demo">
    <st-ghost-text
      content="St Ghost Text Demo"
      horizontal-align="center"
      vertical-align="center"
    ></st-ghost-text>
  </div>
</template>

<style scoped>
.ghost-text-demo {
  padding: 2rem 1rem;
  font-size: 3rem;
  font-weight: bold;
}
</style>

组件参数

参数名说明类型默认值
content文本内容,即要在组件中显示的文本string
horizontalAlign文本水平对其方式'left' | 'center' | 'right''left'
verticalAlign文本垂直对其方式'top' | 'center' | 'bottom''top'
speed要在组件中显示的文本的每个字符动画执行的速度,即动画执行一次所需的时间,单位毫秒number1000
delay要在组件中显示的文本的每个字符动画执行的延迟,即在上一个字符动画执行开始后多少时间当前字符才开始执行动画,单位毫秒number100