|
| 1 | +<template> |
| 2 | + <v-btn |
| 3 | + :block="block" |
| 4 | + :type="type" |
| 5 | + :small="small" |
| 6 | + :large="large" |
| 7 | + :x-large="xLarge" |
| 8 | + :color="color" |
| 9 | + :text="text" |
| 10 | + :tile="tile" |
| 11 | + exact |
| 12 | + :disabled="isLoading" |
| 13 | + @click.prevent="onClick" |
| 14 | + > |
| 15 | + <v-progress-circular |
| 16 | + v-if="isClicked" |
| 17 | + :size="small ? 20 : 25" |
| 18 | + color="grey" |
| 19 | + class="mr-2" |
| 20 | + indeterminate |
| 21 | + ></v-progress-circular> |
| 22 | + <v-icon v-if="icon && !isLoading" left>{{ icon }}</v-icon> |
| 23 | + <slot></slot> |
| 24 | + </v-btn> |
| 25 | +</template> |
| 26 | + |
| 27 | +<script lang="ts"> |
| 28 | +import { Component, PropSync, Prop, Vue, Watch } from 'vue-property-decorator' |
| 29 | +@Component |
| 30 | +export default class SocialButtons extends Vue { |
| 31 | + @Prop({ required: false, type: String, default: 'submit' }) type!: string |
| 32 | + @Prop({ required: false, type: Boolean, default: false }) block!: boolean |
| 33 | + @Prop({ required: false, type: Boolean, default: false }) large!: boolean |
| 34 | + @Prop({ required: false, type: Boolean, default: false }) xLarge!: boolean |
| 35 | + @Prop({ required: false, type: Boolean, default: false }) tile!: boolean |
| 36 | + @Prop({ required: false, type: Boolean, default: false }) text!: boolean |
| 37 | + @Prop({ required: false, type: Boolean, default: false }) small!: boolean |
| 38 | + @Prop({ required: false, type: String, default: 'primary' }) color!: string |
| 39 | + @Prop({ required: false, type: String, default: null }) icon!: string | null |
| 40 | + @PropSync('loading', { required: true, type: Boolean }) isLoading!: boolean |
| 41 | +
|
| 42 | + isClicked = false |
| 43 | +
|
| 44 | + @Watch('loading') |
| 45 | + onChildChanged(submitting: boolean) { |
| 46 | + if (!submitting && this.isClicked) { |
| 47 | + this.isClicked = false |
| 48 | + } |
| 49 | + } |
| 50 | +
|
| 51 | + onClick() { |
| 52 | + this.isClicked = true |
| 53 | + this.$emit('click') |
| 54 | + } |
| 55 | +} |
| 56 | +</script> |
0 commit comments