首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >怎么增加侧抽屉?[Nativescript +角]

怎么增加侧抽屉?[Nativescript +角]
EN

Stack Overflow用户
提问于 2017-02-16 19:34:25
回答 2查看 1.6K关注 0票数 1

在主模块中,我添加了以下内容:

代码语言:javascript
复制
import {SIDEDRAWER_DIRECTIVES} from "nativescript-telerik-ui/sidedrawer/angular";
...
declarations: [
        SIDEDRAWER_DIRECTIVES,
        AppComponent,
        ...AppComponents
]

App.component.html的xml部分:

代码语言:javascript
复制
<RadSideDrawer [drawerLocation]="currentLocation" 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>
</RadSideDrawer>

当我试图运行它时,我会得到错误:

在“主”线程上发生了一个未察觉的异常。com.tns.NativeScriptException:调用js方法onCreateView失败 无法读取未定义文件的属性'android‘:"file:///data/data/org.nativescript.nativescript/files/app/tns_modules/nativescript-telerik-ui/sidedrawer/sidedrawer.js,行: 91,列: 39 file:'file:///data/data/org.nativescript.nativescript/files/app/tns_modules/nativescript-telerik-ui/sidedrawer/sidedrawer.js',行: 91,列: 40帧:函数:‘RadSideDrawer._createUI’,file:'file:///data/data/org.nativescript.nativescript/files/app/tns_modules/nativescript-telerik-ui/sidedrawer/sidedrawer.js',行: 147,列: 18帧:函数:‘View._onContextChanged’,file:'file:///data/data/org.nativescript.nativescript/files/app/tns_modules/ui/core/view.js',行: 202,列: 14帧:函数:‘View._onAttached’,file:'file:///data/data/org.nativescript.nativescript/files/app/tns_modules/ui/core/view.js',行:1

有人知道什么是问题吗?

EN

回答 2

Stack Overflow用户

发布于 2017-04-14 21:25:37

  • 使此进口:

import { NativeScriptUISideDrawerModule } from 'nativescript-telerik-ui/sidedrawer/angular';

  • 将其添加到您的进口中:

imports: [ NativeScriptUISideDrawerModule, ... ]

现在,你的侧抽屉应该能正常工作。

票数 1
EN

Stack Overflow用户

发布于 2018-05-25 21:31:46

解决这样的问题的一个更快的方法是使用NativeScript助手。选择创建一个新项目。其中一个模板具有一个SideDrawer。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42283061

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档