2017-09-01 70 views
3

我已经创建了Ionic 3side menu项目。现在我需要为整个Sidemenu设置渐变背景色。这似乎是一个简单的任务。但它不起作用。有什么想法吗?为整个侧面菜单设置渐变背景色

app.html

<ion-menu [content]="content"> 
    <ion-content class="background-gradient"> 
    <ion-list no-lines> 
     <button menuClose ion-item *ngFor="let p of pages" (click)="openPage(p)" class="border-none" outline> 
      <ion-icon [name]="p.icon" item-left></ion-icon> {{p.title}} 
     </button> 
    </ion-list> 
    </ion-content> 
</ion-menu> 

app.component.ts

@Component({ 
    templateUrl: 'app.html' 
}) 
export class MyApp { 
    @ViewChild(Nav) nav: Nav; 

    rootPage: any = HomePage; 

    pages: Array<{ title: string, component: any, icon: string }>; 

    constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen) { 
    this.initializeApp(); 

    // used for an example of ngFor and navigation 
    this.pages = [ 
     { title: 'Home', component: HomePage, icon: 'game-controller-b' }, 
     { title: 'Activity', component: '', icon: 'browsers' }, 
     { title: 'Contacts', component: '', icon: 'play' }, 
     { title: 'Add Project', component: '', icon: 'settings' }, 
     { title: 'Settings', component: '', icon: 'settings' } 
    ]; 

    } 

app.scss

.background-gradient { 
    background: -webkit-linear-gradient(-55deg, #50a2a7 35%, #e9b44c 100%); 
} 

.border-none { 
    border: none; 
    } 

看起来象是丁字裤他现在:

enter image description here

问:你能告诉我如何添加gradient background colormenu items吗?即整个side menu。我已经尝试了许多ways.But没有运气尚未:(

回答

2

添加了菜单项的背景透明解决了这个:

.border-none{ 
    border: none; 
    background: transparent; 
}