代码之家  ›  专栏  ›  技术社区  ›  Christian

如何将Vue组件中的图标覆盖在另一个图标上?

  •  0
  • Christian  · 技术社区  · 7 年前

    我有一个Vue组件:

    <template>
        <span>
            <i  class="fas fa-file-pdf icon_styling"
                v-bind:style="`color: ` +  fileStatusColor()" ></i>
            <i  class="fas fa-paperclip icon_addition_styling" 
                v-if={{showIcon}}></i>
            {{ mytext }}
        </span>
    </template>
    

    不幸的是,目前的解决方案是 How to overlay one div over another div 不起作用 position:absolute 在整个页面上定向,而不是在我的vue组件中定向。

    有没有办法让图标用html5/css覆盖在我的vue组件中?

    1 回复  |  直到 7 年前
        1
  •  2
  •   Yom T.    7 年前

    他实际上支持 stacked icons

    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
    
    <span class="fa-stack fa-2x">
      <i class="fas fa-file fa-stack-2x icon_styling" style="color: crimson;"></i>
      <i class="fas fa-paperclip fa-stack-1x icon_addition_styling" style="color: white;"></i>
    </span>