uni-app scroll-view 组件内 position: fixed; 定位相对于 scroll-view 而不是整个页面
uni-app scroll-view 组件内 position: fixed; 定位相对于 scroll-view 而不是整个页面
信息类别 | 详情 |
---|---|
产品分类 | uniapp/App |
PC开发环境 | Windows |
操作系统版本 | windows11 |
HBuilderX类型 | 正式 |
HBuilderX版本 | 3.3.12 |
手机系统 | iOS |
手机系统版本 | iOS 12.3 |
手机厂商 | 苹果 |
手机机型 | iPhoneXR |
页面类型 | vue |
vue版本 | vue2 |
打包方式 | 离线 |
项目创建方式 | HBuilderX |
App下载地址 | https://apps.apple.com/cn/app/%E5%AE%89%E7%BB%9C%E6%88%98%E9%B9%B0/id1612225137 |
示例代码:
<template>
<view class="content">
<scroll-view scroll-y="true" >
<view class="content_box">
<button @click="Isright = !Isright" type="default">按钮</button>
<view v-if="Isright" class="right_box"> </view>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
Isright:false
}
}
}
</script>
<style>
.content_box{width: 100%;height: 500rpx;}
.right_box{
position: fixed;
right: 0;top: 0;bottom: 0;
width: 200rpx;background-color: #007AFF;z-index: 9999;
}
.logo {margin: auto;height: 200rpx;width: 200rpx;}
</style>
操作步骤:
- scroll-view使用弹窗
预期结果:
- position: fixed; 元素占据全屏
实际结果:
- 仅继承scroll-view的宽高,未占据全屏
bug描述:
- scroll-view中使用fixed定位,还是相对于scroll-view
更多关于uni-app scroll-view 组件内 position: fixed; 定位相对于 scroll-view 而不是整个页面的实战教程也可以访问 https://www.itying.com/category-93-b0.html
3 回复
更多关于uni-app scroll-view 组件内 position: fixed; 定位相对于 scroll-view 而不是整个页面的实战教程也可以访问 https://www.itying.com/category-93-b0.html