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.
39 lines
742 B
39 lines
742 B
2 years ago
|
<script lang="ts" setup>
|
||
2 years ago
|
import { computed } from '@vue/reactivity'
|
||
|
import { inject, onMounted } from 'vue'
|
||
2 years ago
|
|
||
|
const { modelValue: value } = defineProps<{ modelValue: any }>()
|
||
|
|
||
|
const emit = defineEmits(['update:modelValue'])
|
||
2 years ago
|
const editEnabled = inject<boolean>('editEnabled')
|
||
2 years ago
|
|
||
|
const root = ref<HTMLInputElement>()
|
||
|
|
||
|
const localState = computed({
|
||
|
get() {
|
||
|
return value
|
||
|
},
|
||
|
set(val) {
|
||
|
emit('update:modelValue', val)
|
||
|
},
|
||
|
})
|
||
|
|
||
|
onMounted(() => {
|
||
|
root.value?.focus()
|
||
|
})
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
2 years ago
|
<input v-if="editEnabled" ref="root" v-model="localState" type="number" />
|
||
|
<span v-else>{{ localState }}</span>
|
||
2 years ago
|
</template>
|
||
|
|
||
|
<style scoped>
|
||
|
input {
|
||
|
outline: none;
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
|
color: var(--v-textColor-base);
|
||
|
}
|
||
|
</style>
|