我已經在nativescript中使用RadSideDrawer
指令創建了側邊菜單,並且當我嘗試在其中加載子路由時,除了默認加載,所有後續加載都顯示爲空白屏幕。NativeScript側抽屜無法加載路由器插座
這就是我如何加載內容。
<ScrollView tkMainContent class="menu-content">
<router-outlet></router-outlet>
</ScrollView>
導航邏輯:
<StackLayout>
<StackLayout orientation="horizontal" [nsRouterLink]="['./']" class="menu-item"
[nsRouterLinkActiveOptions]="{exact: true}" nsRouterLinkActive="active" horizontalAlignment="left">
<Label text="{{inspectionsIcon}}" class="icon" ></Label>
<Label text="Reports"></Label>
</StackLayout>
<StackLayout orientation="horizontal" [nsRouterLink]="['properties']" class="menu-item" nsRouterLinkActive="active" horizontalAlignment="left">
<Label text="{{propertiesIcon}}" class="icon" ></Label>
<Label text="Properties" ></Label>
</StackLayout>
<StackLayout orientation="horizontal" [nsRouterLink]="['settings']" class="menu-item" nsRouterLinkActive="active" horizontalAlignment="left">
<Label text="{{settingsIcon}}" class="icon" ></Label>
<Label text="Settings"></Label>
</StackLayout>
</StackLayout>
所以當父路由負載我看到默認的孩子的內容。當我切換到任何其他兒童路線時,我看到一個空白屏幕。任何幫助解決這個問題將不勝感激。
我知道,導航邏輯是好的原因它加載很好,當我剛剛註釋掉RadSideDrawer
並把它作爲一個列表視圖
我在加載RadSideDrawer的根組件中添加了一些斷點,並且控制器只加載一次,你能指導我參考一些代碼示例嗎? – user7138736
哈哈 - 看看這個例子:https://github.com/greenstevester/nativescript-sidedrawer-example –