Skip to content

Commit fdb2329

Browse files
pdanpdanrstoenescu
authored andcommitted
fix: warning about key not being primitive type (quasarframework#751)
* fix: warning about key not beeing primitive type * Also fix key for QStepper
1 parent afc66a4 commit fdb2329

File tree

12 files changed

+18
-18
lines changed

12 files changed

+18
-18
lines changed

dev/components/global/action-sheet.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<q-item
1212
link
1313
v-for="dialog in types"
14-
:key="dialog"
14+
:key="dialog.label"
1515
@click="dialog.handler()"
1616
v-ripple.mat
1717
>

dev/components/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</h4>
1414
<router-link
1515
v-for="feature in category"
16-
:key="feature"
16+
:key="`${ feature.route }${ feature.title }`"
1717
tag="div"
1818
class="q-item q-item-link"
1919
:to="feature.route"

src/components/action-sheet/ActionSheet.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<div v-if="gallery" class="q-action-sheet-gallery row wrap flex-center">
1616
<div
1717
v-for="button in actions"
18-
:key="button"
18+
:key="button.id || JSON.stringify(button)"
1919
class="cursor-pointer relative-position column inline flex-center"
2020
@click="close(button.handler)"
2121
@keydown.enter="close(button.handler)"
@@ -32,7 +32,7 @@
3232
<q-list link v-else class="no-border">
3333
<q-item
3434
v-for="button in actions"
35-
:key="button"
35+
:key="button.id || JSON.stringify(button)"
3636
@click="close(button.handler)"
3737
@keydown.enter="close(button.handler)"
3838
tabindex="0"
@@ -70,7 +70,7 @@
7070
<div v-if="gallery" class="q-action-sheet-gallery row wrap flex-center">
7171
<div
7272
v-for="button in actions"
73-
:key="button"
73+
:key="button.id || JSON.stringify(button)"
7474
class="cursor-pointer relative-position column inline flex-center"
7575
@click="close(button.handler)"
7676
@keydown.enter="close(button.handler)"
@@ -87,7 +87,7 @@
8787
<q-list link v-else class="no-border">
8888
<q-item
8989
v-for="button in actions"
90-
:key="button"
90+
:key="button.id || JSON.stringify(button)"
9191
@click="close(button.handler)"
9292
@keydown.enter="close(button.handler)"
9393
:class="button.classes"

src/components/alert/QAlert.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
>
2525
<span
2626
v-for="btn in actions"
27-
:key="btn"
27+
:key="btn.id || JSON.stringify(btn)"
2828
@click="dismiss(btn.handler)"
2929
v-html="btn.label"
3030
class="uppercase"

src/components/autocomplete/QAutocomplete.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div class="list no-border" :class="{separator: separator}" :style="computedWidth">
1111
<q-item-wrapper
1212
v-for="(result, index) in computedResults"
13-
:key="result"
13+
:key="result.id || JSON.stringify(result)"
1414
:cfg="result"
1515
link
1616
:class="{active: selectedIndex === index}"

src/components/dialog/Dialog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
>
8484
<q-btn
8585
v-for="button in buttons"
86-
:key="button"
86+
:key="button.id || JSON.stringify(button)"
8787
@click="trigger(button.handler, button.preventClose)"
8888
:class="button.classes"
8989
:style="button.style"

src/components/input-frame/QInputFrame.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<template v-if="before">
1010
<q-icon
1111
v-for="item in before"
12-
:key="item"
12+
:key="item.id || JSON.stringify(item)"
1313
class="q-if-control q-if-control-before"
1414
:class="{hidden: __additionalHidden(item, hasError, length)}"
1515
:name="item.icon"
@@ -46,7 +46,7 @@
4646
<template v-if="after">
4747
<q-icon
4848
v-for="item in after"
49-
:key="item"
49+
:key="item.id || JSON.stringify(item)"
5050
class="q-if-control"
5151
:class="{hidden: __additionalHidden(item, hasError, length)}"
5252
:name="item.icon"

src/components/select/QDialogSelect.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
>
3232
<q-chip
3333
v-for="{label, value} in selectedOptions"
34-
:key="label"
34+
:key="`${ label }-${ value.id || JSON.stringify(value) }`"
3535
small
3636
:closable="!disable"
3737
:color="color"

src/components/select/QSelect.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
>
3232
<q-chip
3333
v-for="{label, value} in selectedOptions"
34-
:key="label"
34+
:key="`${ label }-${ value.id || JSON.stringify(value) }`"
3535
small
3636
:closable="!disable"
3737
:color="color"
@@ -81,7 +81,7 @@
8181
<template v-if="multiple">
8282
<q-item-wrapper
8383
v-for="opt in visibleOptions"
84-
:key="opt"
84+
:key="JSON.stringify(opt)"
8585
:cfg="opt"
8686
slot-replace
8787
@click.capture="__toggle(opt.value)"
@@ -103,7 +103,7 @@
103103
<template v-else>
104104
<q-item-wrapper
105105
v-for="opt in visibleOptions"
106-
:key="opt"
106+
:key="JSON.stringify(opt)"
107107
:cfg="opt"
108108
slot-replace
109109
:active="value === opt.value"

src/components/stepper/QStepper.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
>
1111
<step-tab
1212
v-for="(step, index) in steps"
13-
:key="step"
13+
:key="step.name"
1414
:vm="step"
1515
></step-tab>
1616
</div>

0 commit comments

Comments
 (0)