logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

opacity_input.vue (1059B)


  1. <template>
  2. <div
  3. class="opacity-control style-control"
  4. :class="{ disabled: !present || disabled }"
  5. >
  6. <label
  7. :for="name"
  8. class="label"
  9. >
  10. {{ $t('settings.style.common.opacity') }}
  11. </label>
  12. <Checkbox
  13. v-if="typeof fallback !== 'undefined'"
  14. :model-value="present"
  15. :disabled="disabled"
  16. class="opt"
  17. @update:modelValue="$emit('update:modelValue', !present ? fallback : undefined)"
  18. />
  19. <input
  20. :id="name"
  21. class="input input-number"
  22. type="number"
  23. :value="modelValue || fallback"
  24. :disabled="!present || disabled"
  25. max="1"
  26. min="0"
  27. step=".05"
  28. @input="$emit('update:modelValue', $event.target.value)"
  29. >
  30. </div>
  31. </template>
  32. <script>
  33. import Checkbox from '../checkbox/checkbox.vue'
  34. export default {
  35. components: {
  36. Checkbox
  37. },
  38. props: [
  39. 'name', 'modelValue', 'fallback', 'disabled'
  40. ],
  41. emits: ['update:modelValue'],
  42. computed: {
  43. present () {
  44. return typeof this.modelValue !== 'undefined'
  45. }
  46. }
  47. }
  48. </script>