翻譯進行中
本頁尚未翻譯為繁體中文,以下顯示簡體中文原文。範例的預設元件文字仍使用繁體中文。
SkeletonItem 骨架占位块
组成自定义骨架结构的展示块,可单独使用。
引入
uni-app 配置 easycom 后使用 <hui-skeleton-item>。公开类型和函数从 @nscode/handy-uni 导入;普通 Vue 3 安装 @nscode/handy-uni/web 预览插件。
示例
示例可独立运行;交互结果直接显示在页面。
vue
<template>
<view>
<hui-space direction="vertical" fill>
<hui-skeleton-item
v-for="variant in variants"
:key="variant"
custom-class="hui-space__item"
:variant="variant"
:width="variant === 'circle' ? 40 : '80%'"
/>
</hui-space>
</view>
</template>
<script setup lang="ts">
const variants = ['text', 'circle', 'rect', 'image'] as const
</script>
Props
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
variant | SkeletonItemVariant | 'text' | 占位形状:text、circle、rect 或 image。 |
width | number | string | — | 宽度,数字按 px,字符串保留原单位。 |
height | number | string | — | 高度,数字按 px,字符串保留原单位。 |
根节点类名和样式使用 customClass、customStyle。尺寸数字按 px,时长除明确说明外按 ms。
Events
无。
Slots
无。
方法
无。
类型
SkeletonItemVariant、SkeletonItemProps、SkeletonItemEmits.
平台说明
基于共享平台组件实现 H5、微信小程序、App-vue 与普通 Vue 3 Web。单元测试不代替设备验收;触摸、读屏、页面失活和原生组件表现按冒烟清单逐端核对。
设备冒烟清单.