通过SideKick将项目升级到NS6之后,页面导航现在失败,并显示以下错误:-
JS错误TypeError:未定义不是对象(正在评估'frameModule.topmost()。navigate')
以前这没问题。
项目已被tns平台清理为iOS,但问题仍然存在。
这是我的XML页面:
<Page loaded="Loaded" class="page" xmlns="http://www.nativescript.org/tns.xsd" xmlns:pb="nativescript-progressbar">
<ActionBar title="Sites">
<ActionItem tap="logout" ios.position="left" text="Logout"></ActionItem><ActionItem tap="refresh" ios.position="right" ios.systemIcon="13"></ActionItem>
</ActionBar>
<FlexboxLayout class="fb-background">
<!-- <ListView items="{{ sites }}" height="90%" width="98%" class="listitem" itemTap="onListTap" pullToRefresh="true" row="1" pullToRefreshInitiated="{{onPullToRefreshInitiated}}"> -->
<ListView items="{{ sites }}" height="90%" width="98%" class="listitem" itemTap="onListTap">
<ListView.itemTemplate>
<StackLayout orientation="horizontal" class="item" horizontalAlignment="left">
<StackLayout id="{{ sitename }}" orientation="vertical">
<GridLayout columns="auto *" rows="*">
<Label text="{{ sitename }}" class="h2" row="0" col="0" />
</GridLayout>
</StackLayout>
</StackLayout>
</ListView.itemTemplate>
<!-- <ListView.pullToRefreshStyle>
<PullToRefreshStyle indicatorColor="red" indicatorBackgroundColor="blue" />
<ListView.pullToRefreshStyle> -->
</ListView>
</FlexboxLayout>
</Page>
这是我的导航代码:
var frameModule = require("tns-core-modules/ui/frame");
const topmost = require("tns-core-modules/ui/frame").topmost;
exports.onListTap = function (args) {
var index = args.index;
console.log(index);
var livesite = siteslist[index].sitename;
appSettings.setString("livesite", livesite);
const movetosections = {
moduleName: "views/categories/categories-page",
animated: true,
transition: {
name: "flip",
duration: 380,
curve: "easeIn"
}, function(e) {
alert(e);
}
};
frameModule.topmost().navigate(movetosections);
}