Vue
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/vuetify/2.1.12/vuetify.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vuetify/2.1.12/vuetify.min.css">
<div id="app">
<v-container>
<v-expansion-panels :value="activePanelIndex">
<v-expansion-panel
v-for="alarm in alarms"
ref="alarmPanels">
<v-expansion-panel-header>{{alarm.title}}</v-expansion-panel-header>
<v-expansion-panel-content>
<div style="height: 200px">
Some text that should use a lot of height
</div>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
<v-btn
@click="newAlarm"
fixed fab bottom right>New line</v-btn>
</v-container>
</div>
Vue
new Vue({
el: "#app",
data: {
activePanelIndex: null,
alarms: [
{ title: "Line 1" },
{ title: "Line 2" },
{ title: "Line 3" },
{ title: "Line 4" },
{ title: "Line 5" },
{ title: "Line 6" },
{ title: "Line 7" },
{ title: "Line 8" },
{ title: "Line 9" },
{ title: "Line 10" },
]
},
methods: {
newAlarm: function() {
const newAlarmPanelIndex = this.alarms.length - 1;
this.alarms.push({title: "New line"});
this.activePanelIndex = newAlarmPanelIndex;
// TODO:
// (I don't know why in the fiddle the method doesn't exists)
//this.$vuetify.goTo(this.$refs.alarmPanels[newAlarmPanelIndex]);
}
}
})