Skip to content

Commit

Permalink
feat: 调整
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 24659
  • Loading branch information
hyunfa committed Nov 25, 2024
1 parent 9ccf230 commit 81b98bd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions frontend/src/components/common/key-value.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@
<bk-input
v-model="item.key"
:placeholder="`Key ${index + 1}`"
:class="['key-input', { 'is-error': schema.items.required.includes('key') && item.key === '' && isValid[index]}]"
:class="['key-input', { 'is-error': schema.items.required?.includes('key') && item.key === '' && isValid[index]}]"
>
<span
slot="append"
class="error-tip is-error"
v-bk-tooltips="$t('必填项')">
<template v-if="schema.items.required.includes('key') && item.key === '' && isValid[index]">
<template v-if="schema.items.required?.includes('key') && item.key === '' && isValid[index]">
<i class="bk-icon icon-exclamation-circle-shape"></i>
</template>
</span>
</bk-input>
<bk-input
v-model="item.value"
:placeholder="`Value ${index + 1}`"
:class="['value-input', { 'is-error': schema.items.required.includes('value') && item.value === '' && isValid[index] }]"
:class="['value-input', { 'is-error': schema.items.required?.includes('value') && item.value === '' && isValid[index] }]"
>
<span
slot="append"
class="error-tip is-error"
v-bk-tooltips="$t('必填项')">
<template v-if="schema.items.required.includes('value') && item.value === '' && isValid[index]">
<template v-if="schema.items.required?.includes('value') && item.value === '' && isValid[index]">
<i class="bk-icon icon-exclamation-circle-shape"></i>
</template>
</span>
Expand Down Expand Up @@ -125,8 +125,8 @@ export default defineComponent({
isValid.value.fill(true);
isValid.value = [...isValid.value];
const hasEmpty = modelValue.value.some((item) =>
(item.key === '' && props.schema.items.required.includes('key'))
|| (item.value === '' && props.schema.items.required.includes('value')));
(item.key === '' && props.schema.items.required?.includes('key'))
|| (item.value === '' && props.schema.items.required?.includes('value')));
if (hasEmpty) {
cb(false);
}else{
Expand Down

0 comments on commit 81b98bd

Please sign in to comment.