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