2017-09-10 63 views
0

如何在角材2中使用_mat-tabs-background()混入availabel? 這裏是我的MdTab如何在角材2中使用_mat-tabs-background()sass mixin

/* Import your custom input theme file so you can call the custom-input-theme function */ 
@import './components/header/header-links/app-header-links-component-theme.scss'; 

// Be sure that you only ever include this mixin once! 
@include mat-core(); 

@include _mat-tabs-background(#ff0000); 

以下是錯誤消息的自定義主題...

ERROR in ./node_modules/css-loader?{"sourceMap":false,"importLoaders":1}!./node_modules/postcss-loader?{"ident":"postcss"}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false,"preci 
sion":8,"includePaths":[]}!./src/app/app.theme.scss 
Module build failed: 
undefined 
     ^
     Argument `$map` of `map-get($map, $key)` must be a map 

Backtrace: 
     node_modules/@angular/material/_theming.scss:1107, in function `map-get` 
     node_modules/@angular/material/_theming.scss:1107, in function `mat-color` 
     node_modules/@angular/material/_theming.scss:3293, in mixin `-mat-tabs-background` 
     stdin:16 
     in D:\My_Projects\HZone_Web\Final Project\hardware-zone 1.1\node_modules\@angular\material\_theming.scss (line 1107, column 11) 
Error: 
undefined 
     ^
     Argument `$map` of `map-get($map, $key)` must be a map 

回答

0

應該使用私有主題化從源代碼。相反,使用這樣的:

styles.scss(或任何你的文件名是):

@include mat-tabs-theme($theme); // The theme 

然後,您可以使用md-tabbackgroundColor輸入(僅當您安裝2.0.0-beta.10及以上):

<md-tab-group> 
    <md-tab label="One" backgroundColor="primary"> <!-- Can be accent/ warn --> 
     Content here 
    </md-tab> 
    <md-tab label="Two" backgroundColor="accent"> <!-- Can be accent/ warn --> 
     Content here 
    </md-tab> 
</md-tab-group>