0

我在我的 NativeScript 应用程序中使用 Telerik UI 插件来实现抽屉功能。我正在关注本教程 - https://www.nativescript.org/blog/details/using-cross-platform-native-sidedrawer-component -in-nativescript

这是我的代码-

import {Component} from "@angular/core";
import listViewModule = require("nativescript-telerik-ui/listview");
import drawerModule = require("nativescript-telerik-ui/sidedrawer");
@Component({
    selector: "my-app",
    template: `
<drawer:SideDrawer id="drawer1">
   <drawer:SideDrawer.mainContent>

        <!-- Place your page content here -->
        <StackLayout>
        <Label text="Tap the button" class="title"></Label>
        <Button text="TAP" (tap)="onTap()"></Button>
        <Label [text]="message" class="message" textWrap="true"></Label>
        </StackLayout>

       <StackLayout>
        <Button tap="openDrawer" text="ToggleDrawer"/>
       </StackLayout>
   </drawer:SideDrawer.mainContent>

   <drawer:SideDrawer.drawerContent>
     <StackLayout cssClass="drawerContent">
       <StackLayout cssClass="headerContent">
         <Label text="Drawer Header"/>
       </StackLayout>

       <StackLayout cssClass="drawerMenuContent">
         <Label text="Item 1"/>
         <Label text="Item 2"/>
         <Label text="Item 3"/>
         <Label text="Item 4"/>
       </StackLayout>

     </StackLayout>
   </drawer:SideDrawer.drawerContent>
</drawer:SideDrawer>
`,
})
export class AppComponent {
    public counter: number = 16;
    public get message(): string {
        if (this.counter > 0) {
            return this.counter + " taps left";
        } else {
            return "Hoorraaay! \nYou are ready to start building!";
        }
    }

    public onTap() {
        this.counter--;
    }
} 

当我在我的模拟器中运行它时,我得到一个空白页。我将 AngularJS2 与打字稿一起使用,这两个工具都是全新的。所以,无法理解我做错了什么。

需要一些指南。

4

1 回答 1

2
  1. nativescript-telerik-ui\listview 和 sidedrawer 是在 2.0.0-rc.1 之前,所以他们目前正在处理它,你可以查看这个链接 - https://github.com/telerik/nativescript-ui-samples-angular/issues /1#issuecomment-225791969

  2. 如果您使用的是 Angular 的 beta 版本,请检查此存储库链接 - https://github.com/telerik/nativescript-ui-samples-angular/tree/release/sdkAngular/app/sidedrawer

于 2016-06-22T05:50:39.033 回答