z-index 屬性未應用于 ion-segment-button 內的元素。
我嘗試更改元素的位置并將 z-index 設定為 999999 并將按鈕 z-index 設定為 -1。但它不起作用。
<ion-segment-button
class="test">
<ion-icon name="document-text"></ion-icon>
<ion-label>Test</ion-label>
<div id="helpParent" (click)="test2()" style="
background: red;
width: 200px;
height: 200px;
z-index: 999999;
"><i id="helpChild" (click)="test2()" class="far align-vertically fa-question-circle"
style="cursor: pointer;width: 24px;height: 24px;font-size: 20px;color: rgb(6, 54, 85);margin-left: 10px;z-index: 9999;"></i>
</div>
</ion-segment-button>

uj5u.com熱心網友回復:
按鈕在陰影根中呈現,容器元素具有指標事件規則:無;這就是呼叫 test2 方法的原因。
在 style.css 檔案中添加以下代碼,當您單擊內部圖示時應該呼叫 test2 方法,并從 helpParent 元素中洗掉單擊事件以避免多次呼叫。
ion-segment-button::part(native) {
pointer-events: all;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/532962.html
