press-next
Version:
Vue3 组件库,支持 Composition API
68 lines (57 loc) • 1.93 kB
text/typescript
// AI办赛纯文本组件演示数据
export interface Segment {
type: 'text' | 'title' | 'info' | 'link';
text: string;
url?: string; // 仅当 type 为 'link' 时需要
}
export interface ContentObject {
paragraphs: Array<string | Segment[]>;
}
export function getMockData() {
// 基础纯文本内容
const basicText = '这是一段基础的纯文本内容,用于展示组件的基本文本显示功能。';
// 复杂内容 - 包含标题、链接、信息
const complexContent: ContentObject = {
paragraphs: [
[
{ type: 'title', text: '赛事通知' },
{ type: 'text', text: '您好,您报名的比赛即将开始,请注意以下事项:' },
],
[
{ type: 'text', text: '如有疑问,请查看' },
{ type: 'link', text: '比赛规则', url: 'https://example.com/rules' },
{ type: 'text', text: '或联系客服。' },
],
[{ type: 'info', text: '温馨提示:请提前10分钟进入比赛房间' }],
],
};
// 多段落内容
const multiParagraphContent: ContentObject = {
paragraphs: [
'第一段:这是第一段内容,介绍比赛的基本信息。',
'第二段:这是第二段内容,说明参赛要求和注意事项。',
'第三段:这是第三段内容,提供联系方式和帮助信息。',
],
};
// 带自定义样式的内容
const styledContent = '这是一段带有自定义样式的文本内容,展示组件的样式定制能力。';
// 自定义样式配置
const customStyles = {
backgroundColor: 'rgba(211, 212, 252, 0.48)',
borderRadius: '0.08rem',
padding: '0.24rem',
};
// 组件属性配置
const componentProps = {
basicText,
complexContent,
multiParagraphContent,
styledContent,
customStyles,
};
return componentProps;
}
const DEMO_DATA = {
...getMockData(),
};
export default DEMO_DATA;