Skip to content

Instantly share code, notes, and snippets.

@ohiosveryown
Last active November 5, 2018 16:27
Show Gist options
  • Save ohiosveryown/29e0e5feabf15225b8f994ce6e7c48da to your computer and use it in GitHub Desktop.
Save ohiosveryown/29e0e5feabf15225b8f994ce6e7c48da to your computer and use it in GitHub Desktop.
Object Array for Vue
<template>
<main>
<h1>{{ object.first }} {{ object.last }}</h1>
<p>{{ object.age }}</p>
</main>
</template>
<script>
export default {
name: 'HelloWorld',
data: function() {
return {
object: {
first: 'John',
last: 'Doe',
age: '24'
},
another: {
first: 'Jimmer',
last: 'Ferdette',
age: '30'
}
}
}
}
</script>
// before
// data: function() {
// return {
// item: {
// title: '',
// description: '',
// }
// }
// },
// after
// data: () => ({
// item: {
// title: '',
// description: '',
// }
// }),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment