Vuetify: 1.0.4
Vue: 2.5.13
Browsers: Chrome 64.0.3282.186
OS: Mac OS 10.13.3
Add any v-for loop
place a menu or dialog date picker inside
I would like the datepicker to work inside of a v-for - like all of the other inputs.
Does not function properly inside v-for loop
From Vue docs:
You need to use @click="$refs.dialog[index - 1].save(date)" instead.
The dialog model should also be an array so they don't all open at once.
Your my idol
From Vue docs:
You need to use
@click="$refs.dialog[index - 1].save(date)"instead.
The dialog model should also be an array so they don't all open at once.
There is no need to subtract 1
<v-list-tile v-for="(item, index) in data" :key="index">
<v-flex xs2>
<v-menu
ref="dates"
v-model="item.menu"
:close-on-content-click="false"
:nudge-right="40"
:return-value.sync="item.date"
lazy
transition="scale-transition"
offset-y
full-width
min-width="290px"
>
<template v-slot:activator="{ on }">
<v-text-field
v-model="item.date"
label="Picker in menu"
prepend-icon="event"
readonly
v-on="on"
></v-text-field>
</template>
<v-date-picker v-model="item.date" no-title scrollable>
<v-spacer></v-spacer>
<v-btn flat color="primary" @click="item.menu = false">Cancel</v-btn>
<v-btn flat color="primary" @click="$refs.dates[index].save(item.date)">OK</v-btn>
</v-date-picker>
</v-menu>
</v-flex>
</v-list-tile>
Most helpful comment
From Vue docs:
You need to use
@click="$refs.dialog[index - 1].save(date)"instead.The dialog model should also be an array so they don't all open at once.