天天看點

VUE 引用OCX控件,div 被Object遮擋問題

vue引用OCX控件,需要在控件之上添加一個導航欄,但被控件遮擋,添加z-index不生效。在網上找到一些解決方法記錄一下;

這個方法是在需要浮動的視窗div添加一個iframe,因為iframe的級别高于select下拉清單和Object控件,而又由于div能夠遮擋iframe,是以可以通過在div中加入iframe來解決該類問題

<div class="rightf" style="position: absolute;top: 0;right: 0;width: 50px;height:100%;background: #42B983;z-index: 99999999;">
      <iframe id="iframe1" src="about:blank" frame marginHeight="0" marginWidth="0" style="position:absolute; visibility:inherit; top:0px;right:0px;width:50px; height:100%;z-index:-1; filter:alpha(opacity=0);"></iframe>
      <ul class="hul">
        <li><Icon type="ios-notifications-outline" /></li>
        <li><Icon type="ios-person-outline" /></li>
        <li><Icon type="ios-paper-outline" /></li>
        <li><Icon type="logo-nodejs" /></li>
        <li><Icon type="ios-notifications-off-outline" /></li>
      </ul>
    </div>
    <div >
        <router-view></router-view>
    </div>
           

注意:

1.div必須有特定的z-index且大于iframe的z-index,不能是auto或空;2.iframe的z-index必須為負,否則div無法遮蓋iframe;

3.iframe的top和left為0,且iframe的寬、高與div的寬高相等;

4.注意設定iframe的透明度為0.