Stackedit/src/components/modals/FormEntry.vue
2017-10-07 12:22:24 +01:00

24 lines
472 B
Vue

<template>
<div class="form-entry" :error="error">
<label class="form-entry__label" :for="uid">{{label}}</label>
<div class="form-entry__field">
<slot name="field"></slot>
</div>
<slot></slot>
</div>
</template>
<script>
import utils from '../../services/utils';
export default {
props: ['label', 'error'],
data: () => ({
uid: utils.uid(),
}),
mounted() {
this.$el.querySelector('input,select').id = this.uid;
},
};
</script>