z-index爲-1時不能點擊組件的解決的解決辦法

1. z-index設爲0. 主區域設爲position:relative; z-index: 1;這樣能保證背景層不會影響主區域,並且在主區域外的部分也可以點擊。

<template>
<div>
    <div class="bar">

    <div class="content">
</div>
</template>


<style scoped>
.bar {
  position:relative; 
  z-index: 1;
}
.content {
  position:absolute;
  left:0px;
  top:130px;
  z-index:0;
}
</style>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章