field checkbox
This commit is contained in:
parent
1b283b0d56
commit
288c5cbb7e
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "axp-ui",
|
"name": "axp-ui",
|
||||||
"descriiption": "My helper ui lib",
|
"descriiption": "My helper ui lib",
|
||||||
"version": "1.5.17",
|
"version": "1.5.18",
|
||||||
"homepage": "https://antoxahub.ru/antoxa/axp-ui",
|
"homepage": "https://antoxahub.ru/antoxa/axp-ui",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -6,6 +6,7 @@ const props = defineProps<{
|
|||||||
error?: string
|
error?: string
|
||||||
readonly?: boolean
|
readonly?: boolean
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
|
checked?: boolean
|
||||||
tag?: 'input' | 'textarea' | 'select'
|
tag?: 'input' | 'textarea' | 'select'
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
@ -58,6 +59,7 @@ const inputHandler = (val: any) => {
|
|||||||
:value="props.modelValue"
|
:value="props.modelValue"
|
||||||
:reatonly="props.readonly"
|
:reatonly="props.readonly"
|
||||||
:disabled="props.disabled"
|
:disabled="props.disabled"
|
||||||
|
:checked="checked"
|
||||||
@input="inputHandler"
|
@input="inputHandler"
|
||||||
class="input"
|
class="input"
|
||||||
/>
|
/>
|
||||||
|
@ -11,16 +11,17 @@ const props = defineProps<{
|
|||||||
const emit = defineEmits<{ (e: 'update:modelValue', v?: boolean): void }>()
|
const emit = defineEmits<{ (e: 'update:modelValue', v?: boolean): void }>()
|
||||||
|
|
||||||
// Value.
|
// Value.
|
||||||
const valueStr = computed({
|
const value = computed(() => props.modelValue)
|
||||||
get: () => {
|
|
||||||
if (props.modelValue) return 'on'
|
// Handlers.
|
||||||
},
|
const updateHandler = () => emit('update:modelValue', !props.modelValue)
|
||||||
set: val => {
|
|
||||||
if (val !== undefined) emit('update:modelValue', !props.modelValue)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<ui-field type="checkbox" class="ui-field-checkbox" v-model="valueStr" />
|
<ui-field
|
||||||
|
type="checkbox"
|
||||||
|
class="ui-field-checkbox"
|
||||||
|
:checked="value"
|
||||||
|
@input="updateHandler"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
Reference in New Issue
Block a user