constant-rate
v1.0.1
Published
vue3的一个字幕滚动插件库
Downloads
7
Readme
1.安装
yarn add constant-rate 或者 npm install constant-rate
2.在main.ts中
import { createApp } from "vue";
import App from "./App.vue";
import ConstantRate from "constant-rate"; // 引入组件,如果组件有红色波浪线并报错找不到该组件类型,那么在 .d.ts中加入 declare module 'constant-rate'
import "../node_modules/constant-rate/style.css"; // 引入组件样式
const app = createApp(App);
app.use(ConstantRate); //注册
app.mount("#app");
使用
<template>
<ConstantRate :speed="speed">
<template #move>
<span>重要消息</span>
</template>
</ConstantRate>
</template>
<script setup lang="ts">
import { ref } from "vue";
// 参数:speed 代表速度
const speed = ref(20); // 速度,默认是10
</script>