m-sticky-bottom 粘性底部
简述
固定在窗口底部,适配 iPhone 安全区域。
注意
请以 uni_modules/m-unix 与本文为准;各端差异以 uni-app 与各平台官方文档为准。涉及隐私能力(相册、定位、剪贴板、手机号等)需在 manifest 与后台完成配置。
平台差异说明
| App(vue) | App(nvue) | H5 | 小程序 |
|---|---|---|---|
| √ | √ | √ | √ |
演示地址
与线上 H5 演示基座 分包一致(文档站右下角预览 iframe 亦指向同一路径)。
| 类型 | 地址 |
|---|---|
| 分包路径 | pages_demo/ext/sticky/sticky |
| 线上 H5(hash) | 打开演示 |
基本使用
uvue
<template>
<view>
<m-sticky-bottom>
<m-button type="primary">提交</m-button>
</m-sticky-bottom>
</view>
</template>Props
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
zIndex | 层级 | number | 998 |
safeAreaInsetBottom | 是否适配底部安全区域 | boolean | true |
bgColor | 背景颜色 | string | #ffffff |
插槽
| 名称 | 说明 |
|---|---|
default | 底部内容 |
示例
按钮放在粘性底部
uvue
<m-sticky-bottom>
<m-button type="primary" @click="submit">确认提交</m-button>
</m-sticky-bottom>自定义背景色
uvue
<m-sticky-bottom bgColor="#f5f5f5">
<m-button type="primary">确认提交</m-button>
</m-sticky-bottom>