Skip to content

Commit 53a9f47

Browse files
committed
feat: add CFormRadio amd CFormFile custom inputs
1 parent 3a9bc09 commit 53a9f47

File tree

1 file changed

+38
-9
lines changed

1 file changed

+38
-9
lines changed

src/views/base/Forms.vue

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,30 @@
183183
v-for="option in options"
184184
:key="option"
185185
:label="option"
186-
:type="[0,1,4,5].includes(key) ? 'radio' : 'checkbox'"
187186
:value="option"
188-
:custom="key > 3"
187+
:custom="key > 1"
189188
:name="`Option 1${key}`"
190-
:checked="[0,1,4,5].includes(key) ?
191-
`Option 1` : Math.random() > 0.6"
189+
:checked="Math.random() > 0.6"
190+
:class="key % 2 === 1 ? 'form-check-inline' : ''"
191+
/>
192+
</CCol>
193+
</div>
194+
</template>
195+
<template v-for="(name, key) in radioNames">
196+
<div class="form-row form-group" :key="name">
197+
<CCol sm="3">
198+
{{name}}
199+
</CCol>
200+
<CCol sm="9" :class="key % 2 === 1 ? 'form-inline' : ''">
201+
<CFormRadio
202+
v-for="(option, optKey) in options"
203+
:key="option"
204+
:label="option"
205+
type="radio"
206+
:value="option"
207+
:custom="key > 1"
208+
:name="`Option 1${key}`"
209+
checked="Option 1"
192210
:class="key % 2 === 1 ? 'form-check-inline' : ''"
193211
/>
194212
</CCol>
@@ -203,6 +221,17 @@
203221
horizontal
204222
multiple
205223
/>
224+
<CFormFile
225+
label="File custom input"
226+
horizontal
227+
custom
228+
/>
229+
<CFormFile
230+
label="Multiple file custom input"
231+
horizontal
232+
multiple
233+
custom
234+
/>
206235
</CForm>
207236
</CCardBody>
208237
<CCardFooter>
@@ -778,7 +807,7 @@
778807
</template>
779808
</CFormInput>
780809
<CFormInput label="Two-buttons append">
781-
<template v-slot:append>
810+
<template #append>
782811
<CButton variant="primary">Search</CButton>
783812
<CButton variant="danger">Options</CButton>
784813
</template>
@@ -815,10 +844,10 @@ export default {
815844
horizontal: { label:'col-3', input:'col-9' },
816845
options: ['Option 1', 'Option 2', 'Option 3'],
817846
formCollapsed: true,
818-
checkboxNames: ['Radios', 'Inline Radios',
819-
'Checkboxes', 'Inline Checkboxes',
820-
'Radios - custom', 'Inline Radios - custom',
821-
'Checkboxes - custom', 'Inline Checkboxes - custom']
847+
checkboxNames: ['Checkboxes', 'Inline Checkboxes',
848+
'Checkboxes - custom', 'Inline Checkboxes - custom'],
849+
radioNames: ['Radios', 'Inline Radios',
850+
'Radios - custom', 'Inline Radios - custom']
822851
}
823852
},
824853
updated () {

0 commit comments

Comments
 (0)