组件
容器 Container
Container:版心容器。内容限制在指定行宽内并居中。尺寸对应排版行宽而不是断点;页面决定边缘,容器只决定一行文字的长度。
#基础用法
The page hands the container its width; the container hands back a line long enough to settle into and short enough to find its way back to.
<script setup lang="ts">
import { Container } from "@bysages/vue";
</script>
<template>
<!-- The dashed frame is the width the page hands over; the framed
line is the container's answer — a measure held and centered. -->
<div class="border border-dashed border-border-strong rounded-md p-4">
<Container size="readable" class="border border-border bg-surface-2 rounded-md">
<p class="m-0">
The page hands the container its width; the container hands back a line long enough to
settle into and short enough to find its way back to.
</p>
</Container>
</div>
</template>
narrowreadablewidefull<script setup lang="ts">
import { Container } from "@bysages/vue";
const sizes = ["narrow", "readable", "wide", "full"] as const;
</script>
<template>
<div class="grid gap-4 w-full">
<Container
v-for="size in sizes"
:key="size"
:size="size"
class="border border-border bg-surface-2 rounded-md"
>
<code class="text-sm">{{ size }}</code>
</Container>
</div>
</template>
Ink straight to the edge of the measure.
<script setup lang="ts">
import { Container } from "@bysages/vue";
</script>
<template>
<Container size="readable" :padding="false" class="border border-border bg-surface-2 rounded-md">
<p class="m-0">Ink straight to the edge of the measure.</p>
</Container>
</template>
#属性
#Container
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
size | String | "readable" | 内容排版宽度,可为 narrow、readable、wide 或 full |
padding | Boolean | true | — |