File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -19,13 +19,23 @@ struct HomeView: View {
19
19
if let link = selectedDataLinkString {
20
20
DataLink . viewToShow ( for: link, selectInfo: $selectInfo)
21
21
} else {
22
- Text ( " 请选择 " )
22
+ ContentUnavailableView {
23
+ Label ( " 未选择栏目 " ,
24
+ systemImage: " map.circle.fill " )
25
+ } description: {
26
+ Text ( " 请在左侧选择一个栏目 " )
27
+ }
23
28
}
24
29
} detail: {
25
30
if let info = selectInfo {
26
31
DetailLink . viewToShow ( for: " 资料 " , selectInfo: info)
27
32
} else {
28
- Text ( " 请选择 " )
33
+ ContentUnavailableView {
34
+ Label ( " 未选 " ,
35
+ systemImage: " pencil.tip.crop.circle.badge.plus " )
36
+ } description: {
37
+ Text ( " 请选择或按+号增加一个资料 " )
38
+ }
29
39
}
30
40
}
31
41
. environment ( appVM)
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ struct SidebarView: View {
25
25
}
26
26
}
27
27
} )
28
- . frame ( minWidth: 200 )
28
+ // .frame(minWidth: 200)
29
29
}
30
30
}
31
31
Original file line number Diff line number Diff line change @@ -126,18 +126,18 @@ struct EditInfoView: View {
126
126
}
127
127
128
128
func fetchTitleFromUrl( urlString: String , isFetchContent: Bool = false ) async -> ( title: String , content: String ) {
129
+ var title = " 没找到标题 "
129
130
guard let url = URL ( string: urlString) else {
130
- return ( " " , " " )
131
+ return ( title , " " )
131
132
}
132
133
guard let ( data, _) = try ? await URLSession . shared. data ( from: url) else {
133
- return ( " " , " " )
134
+ return ( title , " " )
134
135
}
135
136
guard let homepageHTML = String ( data: data, encoding: . utf8) , let soup = try ? SwiftSoup . parse ( homepageHTML) else {
136
- return ( " " , " " )
137
+ return ( title , " " )
137
138
}
138
139
139
140
// 获取标题
140
- var title = " 没找到标题 "
141
141
let soupTitle = try ? soup. title ( )
142
142
let h1Title = try ? soup. select ( " h1 " ) . first ( ) ? . text ( )
143
143
if let okH1Title = h1Title {
You can’t perform that action at this time.
0 commit comments