Nativescript 如何在页面中包含部分视图?
我一直在尝试使用nativescript测试部分视图,但似乎无法让页面加载部分视图内容 以下是我的主要容器视图:Nativescript 如何在页面中包含部分视图?,nativescript,Nativescript,我一直在尝试使用nativescript测试部分视图,但似乎无法让页面加载部分视图内容 以下是我的主要容器视图: <Page id="tabsPage" class="page" xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:t1="views/tab-test/partial-views/tab1"> <ScrollView> <Button class="btn btn-primary
<Page id="tabsPage" class="page" xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:t1="views/tab-test/partial-views/tab1">
<ScrollView>
<Button class="btn btn-primary" text="test button"/>
<Button tap="GoToTab2" text="Go To Tab 2"/>
<!-- <SegmentedBar selectedIndex="0" selectedIndexChanged="segBarSelected">
<SegmentedBar.items>
<SegmentedBarItem title="Tab 1" />
</SegmentedBar.items>
</SegmentedBar> -->
<t1:tab1 id="tab1" />
</ScrollView>
</Page>
tab1.xml
<Button class="btn btn-primary" text="test button"/>
<Button tap="GoToTab2" text="Go To Tab 2"/>
如您所见,我排除了tab1.xml中的按钮内容在主页上独立显示的可能性,但只要我执行include语句
,就不会显示任何内容
我做错了什么?滚动视图可以包含一个根元素。在创建自定义组件时也应该考虑同样的做法(很好的博客文章)。尝试在StackLayout(或其他布局)中包装自定义组件中的按钮,并对ScrollView的内容执行相同的操作。
tab1.js
----------
函数onLoad(args){
var container=args.object;
container.bindingContext=容器;
}
tab1.xml
----------