我目前正在开发一个简单的测试应用程序,以了解有关@ ngrx/store的更多信息.我有一个名为TrainingModule的模块,它应该存储一些练习和更多信息.代码有效,但我试着在这里改进.我目前拥有的是我的功能模块,如下所示:
@NgModule({
imports: [
CommonModule,
TrainingRoutingModule,
StoreModule.forFeature('exercises', exerciseReducer)
],
declarations: [
TrainingDashboardComponent,
TrainingCoreComponent,
TrainingNavComponent,
TrainingPlanComponent,
ExerciseOverviewComponent,
ExerciseListComponent]
})
export class TrainingModule {
}
Run Code Online (Sandbox Code Playgroud)
和我的减速机看起来像那样:
export interface ExerciseState {
exercises: IExercise[];
}
export interface State extends fromRoot.State {
'exercises': ExerciseState;
}
export const initialState: ExerciseState = {
exercises: [
{id: 1, name: 'Exc 1'},
{id: 2, name: 'Exc 2'}
]
};
export function exerciseReducer(state: ExerciseState = initialState, action: any): ExerciseState {
switch (action.type) {
default:
return state;
}
}
export …Run Code Online (Sandbox Code Playgroud) 我们目前将我们的应用程序上传到苹果商店并得到以下答案:
我们建议实施 Safari View Controller API 以在您的应用程序中显示 Web 内容。Safari View Controller 允许显示 URL 并从应用程序中的嵌入式浏览器检查证书,以便客户可以验证网页 URL 和 SSL 证书,以确认他们将登录凭据输入到合法页面中。
目前我正在使用此代码从我们的应用程序打开网站
Linking.openURL('here-goes-the-url')
Run Code Online (Sandbox Code Playgroud)
所以我有点迷失了这个来自苹果的答案究竟意味着什么。我应该在我的应用程序中使用 WebView 来显示网站内容吗?我试过了,但在那里我看不到苹果评论中提到的任何网址或证书。
到目前为止我发现的是这样的:https : //www.npmjs.com/package/react-native-safari-view-controller
但是这个回购自 2 年以来就没有得到维护。
有没有人可以让我更清楚地说明审稿人对这个答案的意思?我可以使用
WebBrowser.openBrowserAsync('url')
Run Code Online (Sandbox Code Playgroud)
达到他们想要的?
此致
我目前正在使用 .NET Maui,想知道选项卡内的导航是如何工作的。我在文档中找不到我要找的内容,但如果我错过了,也许有人可以为我指出。
所以目前我有一个带有两个底部选项卡的选项卡栏。第二个选项卡显示项目列表,当我单击一个项目时,我想显示一个新页面,其中包含从列表中选择的项目的详细信息。这按预期工作,但如果我单击第一个选项卡,然后返回第二个选项卡(列表),它不会显示列表,而是显示上一个单击项目的详细信息页面。
这就是我的标签栏导航的设置方式
<Shell
x:Class="AthleticAlliance.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:AthleticAlliance.Views"
Shell.FlyoutBehavior="Disabled"
Shell.NavBarIsVisible="False">
<TabBar>
<Tab Title="Dashboard" Icon="home_black_24dp.svg" Route="MainPage">
<ShellContent ContentTemplate="{DataTemplate local:MainPage}"/>
</Tab>
<Tab Title="Workouts" Icon="list_black_24dp.svg" Route="workouts">
<ShellContent ContentTemplate="{DataTemplate local:WorkoutListPage}"/>
</Tab>
</TabBar>
</Shell>
Run Code Online (Sandbox Code Playgroud)
路由到详细信息页面的 AppShell.xaml.cs:
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
Routing.RegisterRoute(nameof(WorkoutDetailsPage), typeof(WorkoutDetailsPage));
}
}
Run Code Online (Sandbox Code Playgroud)
我在文档中是否错过了任何提示,或者我是否必须在详细信息页面的 OnDisappearing 方法中自行清除导航堆栈(如果可能的话,但这似乎是不正确的方法,并且应该更容易做到这一点) )。
先感谢您
// 更新:根据 Jasons 的评论,我找到了解决问题的方法。
我正在使用导航转到我当前所在的选项卡中的根页面
private void ImageButton_Clicked(object sender, EventArgs e)
{
Navigation.PopToRootAsync();
}
Run Code Online (Sandbox Code Playgroud)
我不知道为什么,但我尝试在 viewModel 中进行操作,但没有成功,因为我无权访问那里的导航