fix(nc-gui): use computed value instead on inline condition

This commit is contained in:
Ramesh Mane
2025-05-19 10:52:53 +00:00
parent 82ef91777e
commit 0238e5a919

View File

@@ -12,8 +12,18 @@ const emits = defineEmits<{
const vModel = useVModel(props, 'value', emits)
const { isLoading } = toRefs(props)
const { t } = useI18n()
const inputRef = ref()
const placeholder = computed(() => {
return isLoading.value
? 'Search...'
: `${t('activity.searchProject').charAt(0).toUpperCase()}${t('activity.searchProject').slice(1).toLowerCase()}`
})
const onKeydown = (e: KeyboardEvent) => {
if (e.altKey && e.code === 'KeyB') {
inputRef.value.input?.blur()
@@ -29,11 +39,7 @@ const onKeydown = (e: KeyboardEvent) => {
v-model:value="vModel"
type="text"
class="nc-base-search-input nc-input-border-on-value nc-input-shadow !h-8 !px-2.5 !py-1 !rounded-lg"
:placeholder="
isLoading
? 'Search...'
: `${$t('activity.searchProject').charAt(0).toUpperCase()}${$t('activity.searchProject').slice(1).toLowerCase()}`
"
:placeholder="placeholder"
allow-clear
:readonly="isLoading"
@keydown="onKeydown"