refactor(frontend): use useTemplateRef for DOM referencing
This commit is contained in:
@@ -21,7 +21,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, watch, ref, shallowRef } from 'vue';
|
||||
import { computed, watch, ref, useTemplateRef } from 'vue';
|
||||
import XFeatured from './explore.featured.vue';
|
||||
import XUsers from './explore.users.vue';
|
||||
import XRoles from './explore.roles.vue';
|
||||
@@ -38,7 +38,7 @@ const props = withDefaults(defineProps<{
|
||||
});
|
||||
|
||||
const tab = ref(props.initialTab);
|
||||
const tagsEl = shallowRef<InstanceType<typeof MkFoldableSection>>();
|
||||
const tagsEl = useTemplateRef('tagsEl');
|
||||
|
||||
watch(() => props.tag, () => {
|
||||
if (tagsEl.value) tagsEl.value.toggleContent(props.tag == null);
|
||||
|
Reference in New Issue
Block a user