I am looking to display multiple values on separate lines in a Vuetify snack bar. I have an object and I would like to show key value pairs individually like this:
Brand: Porsche
Model: Cayman
Currently, the format is:
Brand: Porsche, Model: Cayman
Visit my CodePen example for reference.
This is the function code that I am using:
new Vue({
el: '#app',
vuetify: new Vuetify(),
data: () => ({
multiLine: true,
snackbar: false,
text: 'I\'m a multi-line snackbar.',
}),
methods: {
getResult(){
const object = {brand: ['Porsche'], model:['Cayman']};
let result = [];
for (let [key, value] of Object.entries(object)) {
result.push(`${key}: ${value}`);
}
console.log(result);
this.text = result;
this.snackbar = true;
}
}
})