在主模块中,我添加了以下内容:
import {SIDEDRAWER_DIRECTIVES} from "nativescript-telerik-ui/sidedrawer/angular";
...
declarations: [
SIDEDRAWER_DIRECTIVES,
AppComponent,
...AppComponents
]App.component.html的xml部分:
<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
有人知道什么是问题吗?
发布于 2017-04-14 21:25:37
import { NativeScriptUISideDrawerModule } from 'nativescript-telerik-ui/sidedrawer/angular';
imports: [ NativeScriptUISideDrawerModule, ... ]
现在,你的侧抽屉应该能正常工作。
发布于 2018-05-25 21:31:46
解决这样的问题的一个更快的方法是使用NativeScript助手。选择创建一个新项目。其中一个模板具有一个SideDrawer。
https://stackoverflow.com/questions/42283061
复制相似问题