1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <template>
- <!-- #ifdef APP -->
- <scroll-view style="flex: 1">
- <!-- #endif -->
- <view style="flex-grow: 1">
- <view>
- <text>position: fixed</text>
- <scroll-view style="width: 250px; height: 250px; background-color: gray">
- <view style="width: 50px; height: 50px; background-color: red"></view>
- <view class="common fixed" style="position: fixed">
- <text class="text">fixed</text>
- </view>
- <view style="width: 50px; height: 50px; background-color: blue"></view>
- <view style="width: 50px; height: 50px; background-color: red"></view>
- <view style="width: 50px; height: 50px; background-color: green"></view>
- <view style="width: 50px; height: 50px; background-color: blue"></view>
- <view style="width: 50px; height: 50px; background-color: red"></view>
- <view style="width: 50px; height: 50px; background-color: green"></view>
- <view style="width: 50px; height: 50px; background-color: blue"></view>
- </scroll-view>
- </view>
- <view>
- <text>position: relative</text>
- <scroll-view style="width: 250px; height: 250px; background-color: gray">
- <view style="width: 50px; height: 50px; background-color: red"></view>
- <view class="common" style="position: relative">
- <text class="text">relative</text>
- </view>
- <view style="width: 50px; height: 50px; background-color: blue"></view>
- <view style="width: 50px; height: 50px; background-color: red"></view>
- <view style="width: 50px; height: 50px; background-color: green"></view>
- <view style="width: 50px; height: 50px; background-color: blue"></view>
- <view style="width: 50px; height: 50px; background-color: red"></view>
- <view style="width: 50px; height: 50px; background-color: green"></view>
- <view style="width: 50px; height: 50px; background-color: blue"></view>
- </scroll-view>
- </view>
- <view>
- <text>position: absolute</text>
- <scroll-view style="width: 250px; height: 250px; background-color: gray">
- <view style="width: 50px; height: 50px; background-color: red"></view>
- <view class="common" style="position: absolute">
- <text class="text">absolute</text>
- </view>
- <view style="width: 50px; height: 50px; background-color: blue"></view>
- <view style="width: 50px; height: 50px; background-color: red"></view>
- <view style="width: 50px; height: 50px; background-color: green"></view>
- <view style="width: 50px; height: 50px; background-color: blue"></view>
- <view style="width: 50px; height: 50px; background-color: red"></view>
- <view style="width: 50px; height: 50px; background-color: green"></view>
- <view style="width: 50px; height: 50px; background-color: blue"></view>
- </scroll-view>
- </view>
- </view>
- <!-- #ifdef APP -->
- </scroll-view>
- <!-- #endif -->
- </template>
- <style>
- .common {
- width: 50px;
- height: 50px;
- background-color: green;
- top: 25px;
- left: 25px;
- justify-content: center;
- align-items: center;
- }
- .fixed {
- /* #ifdef WEB*/
- top: calc(var(--uni-safe-area-inset-top) + 25px);
- left: calc(var(--uni-safe-area-inset-left) + 25px);
- /* #endif */
- }
- .text {
- white-space: nowrap;
- width: 100%;
- }
- </style>
|