File tree Expand file tree Collapse file tree
docs/.vuepress/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7474</template >
7575
7676<script setup>
77- import { ref , computed } from " vue" ;
77+ import { ref , computed , watch } from " vue" ;
7878
7979const search = ref (" " );
8080const activeTab = ref (0 );
@@ -1915,7 +1915,7 @@ const techData = [
19151915
19161916const filteredData = computed (() => {
19171917 const term = search .value .toLowerCase ();
1918- const result = techData
1918+ return techData
19191919 .map ((item ) => {
19201920 const matchEcosystem = item .ecosystem .toLowerCase ().includes (term);
19211921 const filteredProjects = item .projects .filter ((p ) =>
@@ -1933,11 +1933,13 @@ const filteredData = computed(() => {
19331933 };
19341934 })
19351935 .filter (Boolean );
1936+ });
19361937
1937- // reset activeTab if out of range
1938+ // Reset the active tab when the filtered list changes and the current
1939+ // selection falls out of range. Handled as a side effect in response to
1940+ // dependency changes, keeping the computed getter above pure.
1941+ watch (filteredData, (result ) => {
19381942 if (activeTab .value >= result .length ) activeTab .value = 0 ;
1939-
1940- return result;
19411943});
19421944
19431945function getFilteredProjects (item ) {
You can’t perform that action at this time.
0 commit comments