Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<template>
<div class="form-element">
<div>{{ field.title }}</div>
<slot :field="field"></slot>
<div v-if="empty" class="empty">Must not be empty</div>
</div>
</template>
<script>
export default {
props: {
field: {
type: Object,
default: () => {}
},
},
computed: {
empty() {
if (this.field.value) {
return this.field.value.length === 0
}
return true
}
},
}
</script>
<style scoped>
.form-element {
margin-bottom: 1rem
}
.empty {
color: red
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment