fix
This commit is contained in:
parent
72d73f9a2f
commit
e7549803b6
@ -25,40 +25,35 @@ struct SearchView: View {
|
||||
@State private var isFocused: Bool = true
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 12) {
|
||||
if showSearchResult {
|
||||
if searchModel.dramaGroups.isEmpty {
|
||||
Spacer()
|
||||
Text("什么都没有找到")
|
||||
.font(.system(size: 18))
|
||||
.foregroundColor(Color(hex: "#333333"))
|
||||
Spacer()
|
||||
} else {
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
LazyVStack(alignment: .center, spacing: 10) {
|
||||
ForEach(searchModel.dramaGroups, id: \.group_id) { group in
|
||||
SearchDramaGroupView(group: group)
|
||||
}
|
||||
VStack(spacing: 0) {
|
||||
Color.clear
|
||||
.frame(height: 8)
|
||||
|
||||
VStack {
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
LazyVStack(alignment: .center, spacing: 10) {
|
||||
ForEach(searchModel.dramaGroups, id: \.group_id) { group in
|
||||
SearchDramaGroupView(group: group)
|
||||
}
|
||||
.padding(.top, 8)
|
||||
}
|
||||
.onTapGesture {
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.onTapGesture {
|
||||
isFocused = false
|
||||
}
|
||||
.simultaneousGesture(
|
||||
DragGesture().onChanged{ _ in
|
||||
isFocused = false
|
||||
}
|
||||
.simultaneousGesture(
|
||||
DragGesture().onChanged{ _ in
|
||||
isFocused = false
|
||||
}
|
||||
)
|
||||
}
|
||||
} else {
|
||||
// 预留用来显示热搜词
|
||||
Spacer()
|
||||
)
|
||||
}
|
||||
.overlay(alignment: .center) {
|
||||
Text("什么都没有找到")
|
||||
.font(.system(size: 18))
|
||||
.foregroundColor(Color(hex: "#333333"))
|
||||
.opacity(showSearchResult && searchModel.dramaGroups.isEmpty ? 1 : 0)
|
||||
}
|
||||
|
||||
}
|
||||
.padding(.top, 10)
|
||||
.background(Color(.systemBackground))
|
||||
.navigationTitle("")
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .principal) {
|
||||
@ -69,8 +64,6 @@ struct SearchView: View {
|
||||
.id(toolbarID)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 12)
|
||||
.ignoresSafeArea(.keyboard, edges: .bottom) // 避免键盘遮挡
|
||||
.onAppear {
|
||||
toolbarID = UUID()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user