refactor: single key on template v-for

This commit is contained in:
axolotle 2024-03-04 04:20:02 +01:00
parent fdbe64cf95
commit 03b136478a
5 changed files with 13 additions and 15 deletions

View file

@ -1,8 +1,7 @@
<template> <template>
<BListGroup :flush="flush" :style="{ '--depth': tree.depth }"> <BListGroup :flush="flush" :style="{ '--depth': tree.depth }">
<template v-for="(node, i) in tree.children"> <template v-for="(node, i) in tree.children" :key="node.id">
<BListGroupItem <BListGroupItem
:key="node.id"
class="list-group-item-action" class="list-group-item-action"
:class="getClasses(node, i)" :class="getClasses(node, i)"
@click="$router.push(node.data.to)" @click="$router.push(node.data.to)"
@ -26,7 +25,6 @@
<BCollapse <BCollapse
v-if="node.children" v-if="node.children"
:key="'collapse-' + node.id"
v-model="node.data.opened" v-model="node.data.opened"
:id="'collapse-' + node.id" :id="'collapse-' + node.id"
> >

View file

@ -4,8 +4,8 @@
<BSkeleton width="30%" height="36px" class="m-0" /> <BSkeleton width="30%" height="36px" class="m-0" />
</template> </template>
<template v-for="count in itemCount"> <template v-for="count in itemCount" :key="count">
<BRow :key="count" :class="{ 'd-block': cols === null }"> <BRow :class="{ 'd-block': cols === null }">
<BCol v-bind="cols"> <BCol v-bind="cols">
<div style="height: 38px" class="d-flex align-items-center"> <div style="height: 38px" class="d-flex align-items-center">
<BSkeleton <BSkeleton
@ -32,7 +32,7 @@
</BCol> </BCol>
</BRow> </BRow>
<hr :key="count + '-hr'" /> <hr />
</template> </template>
<template #footer> <template #footer>

View file

@ -96,8 +96,8 @@
:title="$t('group_specific_permissions')" :title="$t('group_specific_permissions')"
icon="group" icon="group"
> >
<template v-for="(userName, index) in activeUserGroups"> <template v-for="userName in activeUserGroups" :key="userName">
<BRow :key="userName"> <BRow>
<BCol md="3" lg="2"> <BCol md="3" lg="2">
<YIcon iname="user" /> <strong>{{ userName }}</strong> <YIcon iname="user" /> <strong>{{ userName }}</strong>
</BCol> </BCol>
@ -116,7 +116,7 @@
/> />
</BCol> </BCol>
</BRow> </BRow>
<hr :key="index" /> <hr />
</template> </template>
<TagsSelectizeItem <TagsSelectizeItem

View file

@ -70,12 +70,12 @@
</BButton> </BButton>
</template> </template>
<template v-for="({ filename, content }, i) in logs"> <template v-for="{ filename, content } in logs" :key="filename">
<h3 :key="i + '-filename'"> <h3>
{{ filename }} {{ filename }}
</h3> </h3>
<pre :key="i + '-content'" class="log"><code>{{ content }}</code></pre> <pre class="log"><code>{{ content }}</code></pre>
</template> </template>
</YCard> </YCard>
</ViewBase> </ViewBase>

View file

@ -1,8 +1,8 @@
<template> <template>
<CardForm :title="$t('tools_webadmin_settings')" icon="cog" no-footer> <CardForm :title="$t('tools_webadmin_settings')" icon="cog" no-footer>
<template v-for="(field, fname) in fields"> <template v-for="(field, fname) in fields" :key="fname">
<FormField v-bind="field" v-model="self[fname]" :key="fname" /> <FormField v-bind="field" v-model="self[fname]" />
<hr :key="fname + 'hr'" /> <hr />
</template> </template>
</CardForm> </CardForm>
</template> </template>