add docs
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<div class="demo">
|
||||
<user-profile :user="user" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { UserProfile } from "timi-tdesign-pc";
|
||||
import type { UserView } from "timi-tdesign-pc";
|
||||
|
||||
/** 演示用图片:内联 SVG,避免依赖外部图床。 */
|
||||
function buildImage(label: string, background: string, width = 320, height = 120) {
|
||||
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}">` +
|
||||
`<rect width="100%" height="100%" fill="${background}"/>` +
|
||||
`<text x="50%" y="50%" font-size="20" fill="#ffffff" text-anchor="middle" ` +
|
||||
`dominant-baseline="central">${label}</text></svg>`;
|
||||
return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;
|
||||
}
|
||||
|
||||
const user: UserView = {
|
||||
id: "demo-001",
|
||||
name: "Timi",
|
||||
profile: {
|
||||
exp: 96,
|
||||
sex: 1,
|
||||
description: "全栈开发,关注前端工程化与组件沉淀。",
|
||||
avatarType: "IR-AUTO",
|
||||
wrapperType: "IR-AUTO",
|
||||
avatarUrl: buildImage("T", "#0052d9", 64, 64),
|
||||
wrapperUrl: buildImage("背景图", "#0594fa")
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user