Skip to content

Commit

Permalink
fix: 修复筛选和搜索时没有互斥
Browse files Browse the repository at this point in the history
  • Loading branch information
lengyibai committed Jul 2, 2024
1 parent 24c0f27 commit 51a8126
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ useUserConfigFinish.readPromise.then(async () => {
/* 搜索英雄/皮肤 */
const handleSearch = () => {
tab_index.value = 0;
const search_keys = ["hero_name"];
//如果为领取皮肤,则支持皮肤搜索
Expand All @@ -133,6 +134,7 @@ const handleSearch = () => {
/* 点击tab栏 */
const onTab = (index: number) => {
search_value.value = "";
tab_index.value = index;
heroListRef.value!.scrollTop = 0;
sortAll();
Expand Down Expand Up @@ -223,7 +225,7 @@ onMounted(() => {
@input="handleSearch"
/>
</div>
<KCategory line :options="options" @tab="onTab" />
<KCategory v-model="tab_index" line :options="options" @update:model-value="onTab" />
</div>
<div ref="heroListRef" v-scroll-virtualization class="hero-list">
<HeroSkinCard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ useUserConfigFinish.readPromise.then(async () => {
/* 搜索英雄 */
const handleSearch = () => {
tab_index.value = 0;
show_list.value = _search<HeroUpgradeInfo>(
_cloneDeep(hero_list.value),
search_value.value,
Expand All @@ -74,6 +75,7 @@ const onSelectAttr = (index: number) => {
/* 点击tab栏 */
const onTab = (index: number) => {
search_value.value = "";
tab_index.value = index;
sortAll();
};
Expand Down Expand Up @@ -123,7 +125,13 @@ const handleSelect = (hero: HeroUpgradeInfo) => {
@input="handleSearch"
/>
</div>
<KCategory v-if="hero_list.length" line :options="options" @tab="onTab" />
<KCategory
v-if="hero_list.length"
v-model="tab_index"
line
:options="options"
@update:model-value="onTab"
/>
</div>
<div v-scroll-virtualization class="hero-list">
<HeroCard
Expand Down

0 comments on commit 51a8126

Please sign in to comment.