3 changed files with 62 additions and 0 deletions
@ -0,0 +1,52 @@ |
|||||
|
<template> |
||||
|
<div v-show="showIfComputed" class="border-solid border"> |
||||
|
<div style="color: rgba(0, 0, 0, 0.6)" class="px-1"> |
||||
|
{{ label }} |
||||
|
</div> |
||||
|
<q-separator /> |
||||
|
<q-option-group v-bind="attrs" :type="optionType" :disable="disableIfComputed" /> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import { computed, defineProps, useAttrs } from 'vue'; |
||||
|
|
||||
|
const attrs = useAttrs(); |
||||
|
const props = defineProps({ |
||||
|
type: { |
||||
|
type: String, |
||||
|
default: '', |
||||
|
}, |
||||
|
label: { |
||||
|
type: String, |
||||
|
default: '', |
||||
|
}, |
||||
|
optionType: { |
||||
|
type: String, |
||||
|
default: 'radio', |
||||
|
}, |
||||
|
showIf: { |
||||
|
type: Function, |
||||
|
default: () => { |
||||
|
return true; |
||||
|
}, |
||||
|
}, |
||||
|
disableIf: { |
||||
|
type: Function, |
||||
|
default: () => { |
||||
|
return false; |
||||
|
}, |
||||
|
}, |
||||
|
form: { |
||||
|
type: Object, |
||||
|
default: undefined, |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
const showIfComputed = computed(() => { |
||||
|
return props.showIf(props.form); |
||||
|
}); |
||||
|
const disableIfComputed = computed(() => { |
||||
|
return props.disableIf(props.form); |
||||
|
}); |
||||
|
</script> |
Loading…
Reference in new issue