2015-04-01 1 views

Répondre

0

Je ne pense pas qu'il soit encore disponible Je pense que vous devez créer votre propre module en tant que vue et faire votre propre navigation (ouvrir, fermer).

Cependant dès la sortie de la boîte je n'ai rien trouvé d'autre dans leurs documents.

L'autre chose que j'ai essayé est d'ajouter un bouton dans l'en-tête, et je n'ai réussi qu'à changer la couleur de l'en-tête, donc je pense que vous devez attendre plus longtemps pour faire ces choses simples.

Ref: Je développe une application de démonstration basée sur Buxfer et NativeScript.

Code Source: https://github.com/chehabz/Buxfer-NativeScript

2

Telerik a annoncé aujourd'hui le Telerik UI for Nativescript en tant que plugin. Le plugin contient maintenant un tiroir latéral et des outils de visualisation de données. C'est un produit commercial mais (seulement) la fonction de tiroir latéral à l'intérieur est gratuite.

Pour plus d'informations, référez-vous au this doc.

+0

Voici également un exemple de projet: https://github.com/telerik/nativescript-ui-samples –

+1

Telerik a changé de réglementation et est passé d'une version gratuite ('nativescript-telerik-ui') et pro (' nativescript -telerik-ui-pro') à 'nativescript-pro-ui' qui offre gratuitement tous ces widgets: http://docs.telerik.com/devtools/nativescript-ui/migration –

0

Je télécharger mon code de travail. Il est en Nativescript + angulaire 2

drawer.html

<RadSideDrawer [drawerLocation]="currentLocation" [transition]="sideDrawerTransition"tkExampleTitle tkToggleNavButton> 
<StackLayout tkDrawerContent class="sideStackLayout"> 
    <StackLayout class="sideTitleStackLayout"> 
     <Label text="Navigation Menu"></Label> 
    </StackLayout> 
    <StackLayout class="sideStackLayout"> 
     <Label text="Primary" class="sideLabel sideLightGrayLabel"></Label> 
     <Label text="Social" class="sideLabel"></Label> 
     <Label text="Promotions" class="sideLabel"></Label> 
     <Label text="Labels" class="sideLabel sideLightGrayLabel"></Label> 
     <Label text="Important" class="sideLabel"></Label> 
     <Label text="Starred" class="sideLabel"></Label> 
     <Label text="Sent Mail" class="sideLabel"></Label> 
     <Label text="Drafts" class="sideLabel"></Label> 
    </StackLayout> 
</StackLayout> 
<StackLayout tkMainContent> 
    <Label [text]="mainContentText" textWrap="true" class="drawerContentText"></Label> 
    <Button text="OPEN DRAWER" (tap)=openDrawer()></Button> 
</StackLayout> 

drawer.component.ts

import {Component , OnInit, Input,ElementRef, ViewChild,ChangeDetectionStrategy,ChangeDetectorRef} from "@angular/core"; 
import { Router } from "@angular/router"; 
import { Page } from "ui/page"; 
import {View} from "ui/core/view"; 
import {Label} from "ui/label"; 
import {RadSideDrawerComponent, SideDrawerType} from 'nativescript-telerik-ui/sidedrawer/angular'; 
import {DrawerTransitionBase, SlideInOnTopTransition} from 'nativescript-telerik-ui/sidedrawer'; 
import * as sideDrawerModule from 'nativescript-telerik-ui/sidedrawer/'; 

@Component({ 
    selector: "hello", 
    templateUrl: "shared/hello/app.hello.html", 
    styleUrls: ["shared/hello/hello.css", "css/app-common.css"], 
}) 
export class HelloComponent implements OnInit{ 

private _currentNotification: string; 
private _sideDrawerTransition: sideDrawerModule.DrawerTransitionBase; 

constructor(private _page: Page, private _changeDetectionRef: ChangeDetectorRef) { 
    this._page.on("loaded", this.onLoaded, this); 
} 

@ViewChild(RadSideDrawerComponent) public drawerComponent: RadSideDrawerComponent; 
private drawer: SideDrawerType; 

ngAfterViewInit() { 
    this.drawer = this.drawerComponent.sideDrawer; 
    this._changeDetectionRef.detectChanges(); 
} 

ngOnInit() { 

} 

public onLoaded(args) { 
    this._sideDrawerTransition = new sideDrawerModule.PushTransition(); 
} 

public get sideDrawerTransition(): sideDrawerModule.DrawerTransitionBase { 
    return this._sideDrawerTransition; 
} 

public get currentNotification(): string { 
    return this._currentNotification; 
} 

public openDrawer() { 
    console.log("openDrawer"); 
    this.drawer.showDrawer(); 
} 

public onDrawerOpening() { 
    console.log("Drawer opening"); 
    this._currentNotification = "Drawer opening"; 
} 

public onDrawerOpened() { 
    console.log("Drawer opened"); 
    this._currentNotification = "Drawer opened"; 
} 

public onDrawerClosing() { 
    console.log("Drawer closing"); 
    this._currentNotification = "Drawer closing"; 
} 

public onDrawerClosed() { 
    console.log("Drawer closed"); 
    this._currentNotification = "Drawer closed"; 
} 
} 

Ne pas oublier d'importer dans le monde app.module.ts ci-dessous:

import { SIDEDRAWER_DIRECTIVES } from "nativescript-telerik-ui/sidedrawer/angular"; 

et dans tableau déclarations ajouter SIDEDRAWER_DIRECTIVES:

declarations: [ 
SIDEDRAWER_DIRECTIVES, 
AppComponent, 
...navigatableComponents 
] 
+0

OMG fonctionne comme un charme! – megatxi

+0

Merci sparkling –