提交 ec747878 编写于 作者: DCloud-yyl's avatar DCloud-yyl

z-index示例页面适配web端的标题栏

上级 a47ac027
<template> <template>
<view style="flex-grow: 1;"> <view style="flex-grow: 1;">
<view> <view>
<view class="common fixed" style="background-color: red;z-index: 10;"> <view class="common fixed default">
<text>position: fixed</text> <text>position: fixed</text>
<text>z-index: 10</text> <text>z-index: 10</text>
</view> </view>
<view class="common fixed" style="background-color: green;z-index: 5;top: 87px;left: 87px;"> <view class="common fixed specified">
<text>position: fixed</text> <text>position: fixed</text>
<text>z-index: 5</text> <text>z-index: 5</text>
</view> </view>
...@@ -43,14 +43,29 @@ ...@@ -43,14 +43,29 @@
</script> </script>
<style> <style>
.common { .common {
width: 125px; width: 125px;
height: 125px; height: 125px;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.fixed {
.fixed {
position: fixed; position: fixed;
} }
.default {
background-color: red;
z-index: 10;
top: var(--window-top);
}
.specified {
background-color: green;
z-index: 5;
left: 87px;
/* #ifdef APP */
top: 87px;
/* #endif */
/* #ifdef H5 */
top: calc(var(--window-top) + 87px);
/* #endif */
}
</style> </style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册