mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
add InputHelper component to deal with ids
This commit is contained in:
parent
6f37de6d29
commit
3e8089275d
1 changed files with 40 additions and 0 deletions
40
app/src/components/InputHelper.vue
Normal file
40
app/src/components/InputHelper.vue
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<template>
|
||||||
|
<b-form-group label-cols="auto" :label="label" :label-for="'input-' + id">
|
||||||
|
<b-input
|
||||||
|
v-model="content"
|
||||||
|
@update="$emit('input', content)"
|
||||||
|
:id="id"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
:aria-describedby="id + '-feedback'"
|
||||||
|
:type="type"
|
||||||
|
:state="state"
|
||||||
|
:required="required"
|
||||||
|
/>
|
||||||
|
<b-form-invalid-feedback :id="id + '-feedback'" :state="state">
|
||||||
|
{{ error }}
|
||||||
|
</b-form-invalid-feedback>
|
||||||
|
</b-form-group>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'InputHelper',
|
||||||
|
props: {
|
||||||
|
// `value` is actually passed thru the `v-model` directive
|
||||||
|
value: { type: [String, Number], required: true },
|
||||||
|
label: { type: String, required: true },
|
||||||
|
id: { type: String, required: true },
|
||||||
|
type: { type: String, default: 'text' },
|
||||||
|
placeholder: { type: String, default: null },
|
||||||
|
state: { type: null, default: null },
|
||||||
|
error: { type: String, default: '' },
|
||||||
|
required: { type: Boolean, default: true }
|
||||||
|
},
|
||||||
|
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
content: this.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in a new issue