我想在点击导航栏的尾随按钮时推动视图,所以我尝试了此操作:
struct ContentView: View {
var body: some View {
NavigationView {
MyListView()
.navigationBarTitle(Text("Main list title"))
.navigationBarItems(trailing: Button("Add", action: {
NavigationLink(destination: MyFormView()) {
Text("Hello!")
}
}))
}
}
}
但是当我点击按钮并没有任何反应时,在NavigationLink行上最终出现了问题:
'NavigationLink
感谢您对我的帮助