2017-10-28 82 views
0

我有一個離子應用程序,它有一個page.html,我嘗試將這個sass代碼應用到我的flexbox表,但不能編譯。我有這樣的CSS樣式背景色沒有mixin命名爲Rtable-cell - Scss中的光線錯誤

     .Rtable-cell--light { 
              background-color: white; 
              border-color: mix(white,$tableColour,80%); 
              } 

,我打電話給我的Rtable細胞內與包括

      .Rtable-cell { 
            box-sizing: border-box; 
            flex-grow: 1; 
            width: 100%; // Default to full width 
            padding: 0.8em 1.2em; 
            overflow: hidden; // Or flex might break 
            list-style: none; 
            border: solid $bw white; 
            background: fade(slategrey,20%); 
            > h1, > h2, > h3, > h4, > h5, > h6 { margin: 0; } 
            margin: -$bw 0 0 -$bw; //border collapse offset 
            @include Rtable-cell--light; 
            } 

爲什麼我得到的錯誤?

我Flexbox的表看起來像這樣

 <div class="Rtable Rtable--4cols"> 

     <div class="Rtable-cell"><h3>Eddard Stark</h3></div> 
     <div class="Rtable-cell">Has a sword named Ice</div> 
     <div class="Rtable-cell">No direwolf</div> 
     <div class="Rtable-cell"><strong>Lord of Winterfell</strong></div> 

     <div class="Rtable-cell"><h3>Jon Snow</h3></div> 
     <div class="Rtable-cell">Has a sword named Longclaw</div> 
     <div class="Rtable-cell">Direwolf: Ghost</div> 
     <div class="Rtable-cell"><strong>Knows nothing</strong></div> 

     <div class="Rtable-cell"><h3>Arya Stark</h3></div> 
     <div class="Rtable-cell">Has a sword named Needle</div> 
     <div class="Rtable-cell">Direwolf: Nymeria</div> 
     <div class="Rtable-cell"><strong>No one</strong></div> 

     </div> 
    </div> 

回答

1

您正在使用錯誤的關鍵字。 .Rtable細胞 - 光不是一個mixin,而是一個選擇,所以不是@include,你應該使用@extend,如:

@extend .Rtable-cell--light; 

文件鏈接:http://sass-lang.com/guide#topic-7

+0

該文檔似乎指向錯誤的部分(#鏈接似乎沒有在那裏正常工作),但你可以找到「擴展/繼承」部分。 :) – vicbyte

+1

更好的是使用[佔位符選擇器](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#Placeholder_Selectors___foo)來避免在一個情況下創建單獨的CSS規則,如果'Rtable-cell-light '僅用作模板。 – Flying

+0

謝謝你,你是對的。我會盡快閱讀更多的sass文檔 –