组件
画框 Frame
Frame:沙箱 iframe 容器。body 渲染默认插槽,`head` 插槽把 style 和 link 元素传送到 iframe 文档;子内容渲染的样式必须通过它传递。(React 包装器用 `head` prop 接收同样内容;两个框架的行为不一致,这是 Ark 的渲染方式决定的。)框架会测量内容并增高适配。容器边框和纸面由使用者提供,因为 iframe 没有 core 样式表可挂载的 anatomy 属性。
#基础用法
<script setup lang="ts">
import { Frame } from "@bysages/vue";
import { h } from "vue";
// <style> tags in a client template are stripped by the compiler, so the
// head slot renders one through a function component instead. Padding
// rides the .frame-root mount, not body — the frame measures that mount,
// so body padding would fall outside its height.
const FrameHead = () =>
h(
"style",
"body { margin: 0; font: 14px/1.6 sans-serif; color: #2a2622; } " +
".frame-root { padding: 16px; } " +
"em { color: #1f4e79; font-style: normal; }",
);
</script>
<template>
<!-- The sandboxed document only exists client-side; hydrating the head
slot against the server's would mismatch. -->
<ClientOnly>
<!-- The vessel's dress is the consumer's (the wrapper carries no
anatomy); the class also resets the UA's fossil 2px inset border. -->
<Frame class="bs-docs-frame">
<template #head>
<FrameHead />
</template>
<p>A <em>frame</em> renders its slot in a sandboxed document.</p>
</Frame>
</ClientOnly>
</template>
#属性
#Content
纯造型的部件——自身没有属性,沿用部件结构的共享样式。