backdrop
组件

宽高比

以期望的宽高比显示内容。
Landscape photograph by Tobias Tullius

核心特性

  • 支持任意自定义比例

安装指南

通过命令行安装此组件。

sh
$ npm add reka-ui

结构解剖

引入组件。

vue
<script setup>
import { AspectRatio } from 'reka-ui'
</script>

<template>
  <AspectRatio />
</template>

API 参考

Root 根组件

包含需要按指定比例约束的内容。

PropDefaultType
as
'div'
AsTag | Component

The element or component this component should render as. Can be overwritten by asChild.

asChild
boolean

Change 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
number

The desired ratio. Eg: 16/9

Slots (default)Payload
aspect
number

Current aspect ratio (in %)