Following the official guide, I am trying to build a simple form that outputs its input into a div on the same template.
Here is my code
<template lang="html">
<div>
<input type="text" name="firstname" value="" v-model="firstname">
<input type="submit">
<div>
<h1>First name</h1>
<p>{{ firstname }}</p>
</div>
</div>
</template>
<script>
export default {
data: function() {
'firstname': '',
}
}
</script>
<style>
</style>
And here is the error:
SyntaxError: Unexpected token, expected ; (28:15)
26 | export default {
27 | data: function() {
> 28 | 'firstname': '',
| ^
@ ./src/App.vue 8:18-97
I have tried to
- remove the quotes from the data keys
- change the data function to an object
Frankly out of ideas as this is so close to the documentation.
Any ideas?