fix search view
This commit is contained in:
parent
4445296da3
commit
b5f6cc9afe
@ -81,7 +81,6 @@ struct SearchView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let response = await API.searchDrama(userId: userId, name: encodeName, as: [DramaGroup].self)
|
let response = await API.searchDrama(userId: userId, name: encodeName, as: [DramaGroup].self)
|
||||||
|
|
||||||
switch response {
|
switch response {
|
||||||
case .result(let dramaGroups):
|
case .result(let dramaGroups):
|
||||||
return dramaGroups
|
return dramaGroups
|
||||||
@ -151,7 +150,7 @@ extension SearchView {
|
|||||||
|
|
||||||
@Binding<String> var searchText: String
|
@Binding<String> var searchText: String
|
||||||
var placeholder: String
|
var placeholder: String
|
||||||
var onTap: () -> Void
|
var onSearch: () -> Void
|
||||||
|
|
||||||
@FocusState private var isFocused
|
@FocusState private var isFocused
|
||||||
|
|
||||||
@ -161,11 +160,11 @@ extension SearchView {
|
|||||||
// 输入框
|
// 输入框
|
||||||
TextField(placeholder, text: $searchText)
|
TextField(placeholder, text: $searchText)
|
||||||
.textFieldStyle(PlainTextFieldStyle())
|
.textFieldStyle(PlainTextFieldStyle())
|
||||||
.keyboardType(.emailAddress)
|
.keyboardType(.default)
|
||||||
.focused($isFocused)
|
.focused($isFocused)
|
||||||
.submitLabel(.search)
|
.submitLabel(.search)
|
||||||
.onSubmit {
|
.onSubmit {
|
||||||
onTap()
|
onSearch()
|
||||||
}
|
}
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
.padding(8)
|
.padding(8)
|
||||||
@ -188,7 +187,7 @@ extension SearchView {
|
|||||||
|
|
||||||
// 搜索按钮
|
// 搜索按钮
|
||||||
Button {
|
Button {
|
||||||
onTap()
|
onSearch()
|
||||||
} label: {
|
} label: {
|
||||||
Text("搜索")
|
Text("搜索")
|
||||||
.font(.system(size: 18))
|
.font(.system(size: 18))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user