Skip to content
iuiDesign
100%
02:32
本页目录

粘性布局组件,元素相对于窗口或指定容器的吸顶效果。

基本使用

html
<iui-sticky>
  <view class="layout"> 基本用法 </view>
</iui-sticky>
<iui-sticky>
  <view class="layout"> 基本用法 </view>
</iui-sticky>
css
.layout {
  background: #165dff;
  color: white;
  padding: 10px;
  position: inherit;
  font-size: 14px;
}
.layout {
  background: #165dff;
  color: white;
  padding: 10px;
  position: inherit;
  font-size: 14px;
}

吸顶距离

html
<iui-sticky :offsetTop="50">
  <view class="layout"> 顶部距离 </view>
</iui-sticky>
<iui-sticky :offsetTop="50">
  <view class="layout"> 顶部距离 </view>
</iui-sticky>

API

<Sticky>props
参数描述类型默认值
offsetTop吸顶时与顶部的距离Number0
z-index元素 z-indexNumber1000