Last active
September 20, 2017 20:42
-
-
Save VitorLuizC/0db416b8fb1b2fa3965226d5e7462fb4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
<fieldset> | |
<div class="field"> | |
<label>Rua</label> | |
<input type="text" :value="data.street" @change="event => $emit('input', { street: street })" /> | |
</div> | |
... | |
</fieldset> | |
</template> | |
<script> | |
export default { | |
props: { | |
data: { | |
type: Object, | |
default: () => ({}) | |
} | |
} | |
} | |
</script> | |
This file contains hidden or 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> | |
<form @submit="send"> | |
<address-fieldset :data="data" @input="update" /> | |
... | |
<button type="submit">Enviar</button> | |
</form> | |
</template> | |
<script> | |
import AddressFieldset from './AddressFieldset' | |
... | |
export default { | |
components: { | |
AddressFieldset, | |
... | |
}, | |
data () { | |
return { | |
street: 'Av. Paulista', | |
... | |
} | |
}, | |
methods: { | |
change (fields) { | |
this.data = { ...this.data, ...fields } | |
}, | |
send () { | |
... | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment