Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
R
rrpgLink_FrontEnd
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kesaubeeire
rrpgLink_FrontEnd
Commits
25eeb5db
Commit
25eeb5db
authored
Oct 22, 2023
by
KesaubeEire
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 搜索重复整理.
parent
c3b438fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
src/Content.svelte
src/Content.svelte
+12
-5
No files found.
src/Content.svelte
View file @
25eeb5db
...
@@ -58,6 +58,7 @@
...
@@ -58,6 +58,7 @@
};
};
};
};
let lastSearchURL;
/**创建请求 fetch 函数
/**创建请求 fetch 函数
* @param {object} param0 参数对象
* @param {object} param0 参数对象
* @param {function} callback 回调函数
* @param {function} callback 回调函数
...
@@ -74,10 +75,20 @@
...
@@ -74,10 +75,20 @@
if (params.method == 'POST') msg.body = payload;
if (params.method == 'POST') msg.body = payload;
if (params.headers) msg.headers = params.headers;
if (params.headers) msg.headers = params.headers;
if (lastSearchURL == url) {
toast.push('搜索参数重复捏~');
return;
}
lastSearchURL = url;
fetch(url, msg)
fetch(url, msg)
.then(response => response.json())
.then(response => response.json())
.then(data => {
.then(data => {
// console.log(data);
// console.log(data);
if (!data.length) {
toast.push('没有搜索到东西捏~');
return;
}
// 处理数据
// 处理数据
callback(data);
callback(data);
...
@@ -137,16 +148,12 @@
...
@@ -137,16 +148,12 @@
*/
*/
export function searchTitle(title) {
export function searchTitle(title) {
if (title === lastSearch) {
if (title === lastSearch) {
toast.push('
重复搜索
捏~');
toast.push('
搜索名称重复
捏~');
return;
return;
}
}
lastSearch = title;
lastSearch = title;
if (process.env.APP_ENV === 'dev') console.log('执行搜索:\t', title);
if (process.env.APP_ENV === 'dev') console.log('执行搜索:\t', title);
createFetch(searchTextRequest(title), data => {
createFetch(searchTextRequest(title), data => {
if (!data.length) {
toast.push('没有搜索到东西捏~');
return;
}
if (process.env.APP_ENV === 'dev') console.log(data);
if (process.env.APP_ENV === 'dev') console.log(data);
showList(data);
showList(data);
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment