mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
731 B
38 lines
731 B
<script lang="ts" setup> |
|
import { computed, inject, onMounted, ref } from '#imports' |
|
|
|
interface Props { |
|
modelValue: number |
|
} |
|
|
|
const { modelValue: value } = defineProps<Props>() |
|
|
|
const emit = defineEmits(['update:modelValue']) |
|
|
|
const editEnabled = inject<boolean>('editEnabled') |
|
|
|
const root = ref<HTMLInputElement>() |
|
|
|
const localState = computed({ |
|
get: () => value, |
|
set: (val) => emit('update:modelValue', val), |
|
}) |
|
|
|
onMounted(() => { |
|
root.value?.focus() |
|
}) |
|
</script> |
|
|
|
<template> |
|
<input v-if="editEnabled" ref="root" v-model="localState" type="number" /> |
|
<span v-else>{{ localState }}</span> |
|
</template> |
|
|
|
<style scoped> |
|
input { |
|
outline: none; |
|
width: 100%; |
|
height: 100%; |
|
color: var(--v-textColor-base); |
|
} |
|
</style>
|
|
|