The plugin is applied like that:
- Search for an send tag inside the page
- If found, get the parent form tag and add all the inputs to the form config
- Add the forms.js and the config to the view
- In forms.js for each form, form.js is used as compoent mounted to the respetive form element.
This file has the child component send.vue, what will cause to render the send tag as vue component.
You don't have to add v-show to the error slot, as it is only shown if status == 3
HTML: send.vue
- <template>
- <button :class="class" type="submit" :disabled="status > 0">
- <slot v-if="status == 0">
- {{ 'Send' | trans }}
- </slot>
- <slot name="sending" v-if="status == 1">
- {{ 'Sending' | trans }}
- </slot>
- <slot name="success" v-if="status == 2">
- {{ 'Sent' | trans }}
- </slot>
- <slot name="error" v-if="status == 3">
- {{ 'Unable to send mail.' | trans }}
- </slot>
- </button>
- </template>