Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <v-flex xs12 sm4>
- <v-dialog
- ref="dialog"
- v-model="modal"
- :return-value.sync="date"
- persistent
- lazy
- full-width
- width="290px"
- >
- <v-text-field
- slot="activator"
- v-model="computedDateFormatted"
- label="Data do Evento"
- prepend-icon="event"
- readonly
- ></v-text-field>
- <v-date-picker v-model="date" locale="pt-BR">
- <v-spacer></v-spacer>
- <v-btn flat color="primary" @click="modal = false">Cancelar</v-btn>
- <v-btn flat color="primary" @click="$refs.dialog.save(date)">OK</v-btn>
- </v-date-picker>
- </v-dialog>
- </v-flex>
- data() {
- return {
- date:null,
- modal:false,
- }
- },
- computed: {
- computedDateFormatted () {
- return this.formatDateToBr(this.date)
- },
- },
- watch:{
- date (val) {
- this.dateFormatted = this.formatDateToBr(this.date);
- },
- },
- methods: {
- formatDateToBr (date) {
- if (!date) return null
- const [year, month, day] = date.split('-')
- return `${day}/${month}/${year}`
- },
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement