yandere_fe/src/components/opacity_input/opacity_input.vue

50 lines
1.0 KiB
Vue
Raw Normal View History

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