Last active
June 15, 2016 00:59
-
-
Save tiagoeborsanyi/8a5f1d70cafcd8b8f07f18d86141ff14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="col-md-6 col-md-offset-3"> | |
<h4>Cadastre um lugar que você já foi e deixe um comentário</h4> | |
<div class="alert alert-danger" v-if="error"> | |
<p>{{ error }}</p> | |
</div> | |
<form class="" @submit.prevent="salva()"> | |
<div class="form-group"> | |
<input type="text" class="form-control" placeholder="Entre com o titulo" v-model="lugares.titulo"> | |
</div> | |
<div class="form-group"> | |
<textarea class="form-control" rows="3" placeholder="Entre com a descrição" v-model="lugares.descricao"></textarea> | |
</div> | |
<button class="btn btn-primary" type="submit">Salvar</button> | |
</form> | |
</div> | |
<template> | |
<script lang="babel"> | |
import auth from '../auth' | |
export default { | |
data() { | |
return { | |
lugares: { | |
titulo: '', | |
descricao: '' | |
}, | |
error: '' | |
} | |
}, | |
methods: { | |
salva() { | |
var place = { | |
titulo = this.lugares.titulo, | |
descricao: this.lugares.descricao | |
} | |
console.log(place) | |
} | |
} | |
} | |
</script> | |
Erro: | |
vue.common.js?e881:1014[Vue warn]: Error when evaluating expression "lugares.titulo": TypeError: Cannot read property 'titulo' of undefined | |
vue.common.js?e881:1014[Vue warn]: Error when evaluating expression "lugares.descricao": TypeError: Cannot read property 'descricao' of undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment