Преглед на файлове

【左边栏】- 搜索记录10条只显示9条的问题修复。

liaoxiaoyue преди 1 година
родител
ревизия
d5b9d678d2
променени са 1 файла, в които са добавени 5 реда и са изтрити 4 реда
  1. 5 4
      PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/Search/KMSearchViewController.swift

+ 5 - 4
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/Search/KMSearchViewController.swift

@@ -137,14 +137,15 @@ class KMSearchViewController: NSViewController, NSTextFieldDelegate, NSSearchFie
         let searchString = self.searchTextField.stringValue
         
         if searchString != "" {
-            if searchs.count == 10 {
-                searchs.remove(at: 9)
-            }
-            
             //缓存搜索词汇是否重复
             if searchs.contains(searchString) {
                 searchs.removeObject(searchString)
             }
+            
+            if searchs.count == 10 {
+                searchs.remove(at: 9)
+            }
+            
             searchs.insert((self.searchTextField.stringValue), at: 0)
             UserDefaults.standard.set(searchs, forKey: CPDFOfficeSearchHistoryKey)