宽高比
以期望的宽高比显示内容。
核心特性
- 支持任意自定义比例
安装指南
通过命令行安装此组件。
sh
$ npm add reka-ui结构解剖
引入组件。
vue
<script setup>
import { AspectRatio } from 'reka-ui'
</script>
<template>
<AspectRatio />
</template>API 参考
Root 根组件
包含需要按指定比例约束的内容。
| Prop | Default | Type |
|---|---|---|
as | 'div' | AsTag | ComponentThe element or component this component should render as. Can be overwritten by |
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details. | |
ratio | 1 | numberThe desired ratio. Eg: 16/9 |
| Slots (default) | Payload |
|---|---|
aspect | numberCurrent aspect ratio (in %) |
