mpvue——修改第三方組件樣式

前言

 

咱們都知道在vue中能夠定義多個<style>,通常爲了防止全局污染,咱們會使用<style scoped>表明這裏面的css樣式只在本頁面生效。css

 

全局

這個當時測試是直接寫,沒有加層級,而後樣式沒生效,後面就直接刪除,在私有的裏面進行穿透修改了!若是要測試最好加本頁面的大類,否則會污染全局!!!因此仍是推薦私有穿透吧。vue

<style >

</style>

 

私有

使用/deep/進行穿透,在mpvue中使用>>>穿透,編譯會報錯測試

.form-area {
      width: 100%;
      bottom: 1.88rem;
      .form-wrap {
        width: 340px;
        position: relative;
        left: 20px;
        .form-item {
          width: 100%;
          height: 50px;
          margin: 5px 0;
          border-radius: 10px;
          background-color: #fff;
        /deep/.van-cell {
            width: 240px !important;
            position: none !important;
          }
        }
      }
相關文章
相關標籤/搜索