search

Home  >  Q&A  >  body text

css - vue 动态获取图片作为背景 想实现背景模糊文字不模糊的效果

template>
    <p id="playPage" class="blur" v-bind:style="{backgroundImage: 'url(' + albumpic_big + ')'}">
<!--       {{albumpic_big}}-->
            <p class="header">
           <ul>
               <li class="icon">
                    <img src="../img/unfold.svg">
               </li>
               <li class="songName">
                   {{songName}}
               </li>
              <li class="icon">
                  <img src="../img/more.svg">
              </li>
           </ul>
        </p>
        <p>-{{singer}}-</p>
    </p>
</template>

    #playPage{
        width: 100%;
        height: 100%;
        position: relative;
    }
    #playPage.blur{
        position: absolute;
        top: 0;
        left: 0;
        background-size:cover;
        filter: blur(8px)
    }
    #playPage:before{
        content: '';
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        filter: blur(7px);
        z-index: -1;
    }

之前这样我都是直接写伪元素 设置背景图是在伪元素上 但是因为绑定的数据不能写在css中 所以不知道怎么办

伊谢尔伦伊谢尔伦2866 days ago690

reply all(2)I'll reply

  • PHPz

    PHPz2017-04-17 11:59:49

    <p id="playPage" class="blur" v-bind:style="{backgroundImage: 'url(' + albumpic_big + ')'}"></p>
    <p class="header">
       <ul>
           <li class="icon">
                <img src="../img/unfold.svg">
           </li>
           <li class="songName">
               {{songName}}
           </li>
          <li class="icon">
              <img src="../img/more.svg">
          </li>
       </ul>
    </p>
    <p>-{{singer}}-</p>
    让文字内容独立出来,再用定位解决怎么样?

    reply
    0
  • 阿神

    阿神2017-04-17 11:59:49

    Where are the great gods><

    reply
    0
  • Cancelreply