Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- Para ficar mais limpo, estou usando Pug nos exemplos. -->
- <template lang="pug">
- form(v-on:submit.prevent="submitForm()")
- input(type="text" v-model="user.name" name="name" placeholder="Nome do Usuário")
- input(type="email" v-model="user.email" name="email" placeholder="Email do Usuário")
- input(type="password" v-model="user.password" name="password" placeholder="Senha do Usuário")
- button.button(type="submit") Salvar
- </template>
- <script>
- export default {
- name: 'userForm',
- props: {
- user: {
- required: false,
- default: () => {
- return {
- name: '',
- email: '',
- password: ''
- }
- }
- }
- },
- methods: {
- submitForm () {
- this.$emit('submit', this.user)
- }
- }
- }
- </script>
- <style scoped>
- </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement