diff --git a/src/widgets/marquee/Config.vue b/src/widgets/marquee/Config.vue new file mode 100644 index 0000000..c44ae93 --- /dev/null +++ b/src/widgets/marquee/Config.vue @@ -0,0 +1,431 @@ + + + 滚动公告小组件设置 + + + 预设样式 + + + + 经典滚动 + 现代风格 + 游戏主题 + 垂直轮播 + + + + 基本设置 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 文本样式 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 容器样式 + + + + + + + + + + + + + + + + + + + + + + 其他设置 + + + + + 循环播放 + + + + 鼠标悬停暂停 + + + + + + + + + + + diff --git a/src/widgets/marquee/Widget.vue b/src/widgets/marquee/Widget.vue new file mode 100644 index 0000000..2b618ac --- /dev/null +++ b/src/widgets/marquee/Widget.vue @@ -0,0 +1,352 @@ + + + + {{ config.content }} + {{ config.content }} + + + + + + {{ line }} + + + + + + + + + diff --git a/src/widgets/marquee/index.ts b/src/widgets/marquee/index.ts new file mode 100644 index 0000000..395439c --- /dev/null +++ b/src/widgets/marquee/index.ts @@ -0,0 +1,14 @@ +import Widget from './Widget.vue'; +import Config from './Config.vue'; +import { defaultConfig } from './types'; +import { createWidget } from '../createWidget'; + +export default createWidget({ + label: '滚动公告', + value: 'marquee', + icon: '📢', + description: '可定制内容、样式和滚动效果的公告滚动条,支持水平和垂直滚动', + component: Widget, + configComponent: Config, + defaultConfig +}); diff --git a/src/widgets/marquee/types.ts b/src/widgets/marquee/types.ts new file mode 100644 index 0000000..df2f14f --- /dev/null +++ b/src/widgets/marquee/types.ts @@ -0,0 +1,67 @@ +// 滚动公告小组件配置接口 +export interface MarqueeConfig { + // 公告内容 + content: string; + // 文本样式 + color: string; + fontSize: number; + fontWeight: string; + fontFamily: string; + textShadow: boolean; + shadowColor: string; + shadowBlur: number; + useGradient: boolean; + gradientColors: string[]; + + // 滚动配置 + direction: 'horizontal' | 'vertical'; + horizontalDirection: 'left' | 'right'; + speed: number; // 水平滚动速度 (px/s) + + // 垂直滚动特有配置 + verticalInterval: number; // 垂直滚动时行间隔时间 (秒) + lineHeight: number; // 行高倍数 + displayLines: number; // 每次显示的行数 + + // 容器样式 + backgroundColor: string; + borderRadius: number; + padding: number; + width: number; + height: number; + + // 其他配置 + loop: boolean; // 是否循环播放 + pauseOnHover: boolean; // 鼠标悬停时是否暂停 +} + +// 滚动公告小组件默认配置 +export const defaultConfig: MarqueeConfig = { + content: '欢迎关注我的直播间 ★ 记得点赞订阅哦 ♥ 感谢大家的支持!', + color: '#ffffff', + fontSize: 24, + fontWeight: 'normal', + fontFamily: 'Microsoft YaHei', + textShadow: true, + shadowColor: 'rgba(0,0,0,0.7)', + shadowBlur: 3, + useGradient: false, + gradientColors: ['#ff6b6b', '#4ecdc4'], + + direction: 'horizontal', + horizontalDirection: 'left', + speed: 80, + + verticalInterval: 3, + lineHeight: 1.4, + displayLines: 1, + + backgroundColor: 'rgba(0,0,0,0.6)', + borderRadius: 25, + padding: 12, + width: 600, + height: 50, + + loop: true, + pauseOnHover: true +}; diff --git a/src/widgets/registry.ts b/src/widgets/registry.ts index 5a19a56..a7175e6 100644 --- a/src/widgets/registry.ts +++ b/src/widgets/registry.ts @@ -4,6 +4,7 @@ import DateWidget from './date'; import TextWidget from './text'; import ImageWidget from './image'; import TimerWidget from './timer'; +import MarqueeWidget from './marquee'; // 导入类型定义 @@ -16,6 +17,7 @@ export const widgets: WidgetRegistration[] = [ TextWidget, ImageWidget, TimerWidget, + MarqueeWidget, ]; // 获取小组件显示信息列表(用于 UI 展示)