Commit 048e28da authored by JoyJ's avatar JoyJ

fix search loop

parent 6031cd45
Pipeline #23797 failed with stages
......@@ -53,7 +53,7 @@
.catch(error => {
// 处理错误
console.error('网络请求错误:', error);
我处理一下就行;
//我处理一下就行;
toast.push('网络请求错误');
});
}
......@@ -74,7 +74,7 @@
List = [...List, ...data];
}
function search(args) {
function searchTag(args) {
let searchInfo = {
url: `${$_env}/query.php?action=get&${args}`,
params: {
......@@ -85,12 +85,18 @@
}
}
};
List = [];
createFetch(searchInfo, data => {
console.log(data);
showList(data);
});
}
function onSearch(e) {
console.log('triggered search');
console.log(e.detail.text);
}
</script>
<!-- ----------------------------------------------- DOM ----------------------------------------------- -->
......@@ -103,7 +109,7 @@
cover={$_env + '/' + item.folder.substring(2) + '/rpg_info/1.jpg' ?? ''}
language={categoryList[item.category] || "未知"}
raw_tags={item.tags}
on:search={search(`tags=${(ev)=>{search(ev.detail.tag)}}`)}
on:search={onSearch}
/>
{/each}
<Card raw_tags="|示例1|示例2|" />
......
......@@ -13,9 +13,10 @@
let error = false;
const raiseEvent = createEventDispatcher();
function searchByTag(tag) {
function searchByTag(e) {
console.log(e);
raiseEvent('search', {
tag: tag
text: e.target
});
}
</script>
......@@ -56,8 +57,7 @@
{#each tags as tag}
<div
class="badge badge-outline"
on:click={searchByTag(tag)}
on:keypress={searchByTag(tag)}>{tag}</div>
on:mousedown={searchByTag}>{tag}</div>
{/each}
{/if}
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment