akkoma-fe/src/components/opacity_input/opacity_input.vue

50 lines
1 KiB
Vue
Raw Normal View History

2018-10-07 16:59:22 +00:00
<template>
2019-07-05 07:17:44 +00:00
<div
class="opacity-control style-control"
:class="{ disabled: !present || disabled }"
>
<label
:for="name"
class="label"
>
{{ $t('settings.style.common.opacity') }}
</label>
<Checkbox
2019-07-05 07:17:44 +00:00
v-if="typeof fallback !== 'undefined'"
2022-03-29 12:35:18 +00:00
:model-value="present"
:disabled="disabled"
class="opt"
2022-03-27 11:18:02 +00:00
@update:modelValue="$emit('update:modelValue', !present ? fallback : undefined)"
2019-07-05 07:17:44 +00:00
/>
<input
:id="name"
class="input-number"
type="number"
2022-03-28 20:55:11 +00:00
:value="modelValue || fallback"
2019-07-05 07:17:44 +00:00
:disabled="!present || disabled"
max="1"
min="0"
step=".05"
2021-04-25 10:23:16 +00:00
@input="$emit('update:modelValue', $event.target.value)"
2019-07-05 07:17:44 +00:00
>
</div>
2018-10-07 16:59:22 +00:00
</template>
<script>
import Checkbox from '../checkbox/checkbox.vue'
2018-10-07 16:59:22 +00:00
export default {
components: {
Checkbox
},
2020-01-12 15:59:41 +00:00
props: [
2022-03-27 11:18:02 +00:00
'name', 'modelValue', 'fallback', 'disabled'
2020-01-12 15:59:41 +00:00
],
2022-03-27 11:18:02 +00:00
emits: ['update:modelValue'],
2018-10-07 16:59:22 +00:00
computed: {
present () {
2022-03-27 11:18:02 +00:00
return typeof this.modelValue !== 'undefined'
2018-10-07 16:59:22 +00:00
}
}
}
</script>