fix: handle null

This commit is contained in:
puriphatt 2024-11-13 16:40:54 +07:00
parent fe83de88de
commit 00157a420b

View file

@ -283,7 +283,7 @@ watch(
if (ret) { if (ret) {
currWorkflow.value = ret; currWorkflow.value = ret;
tempStep.value = tempStep.value =
ret.step.length > 0 ret.step?.length > 0
? ret.step.map((s) => ({ ? ret.step.map((s) => ({
name: s.name, name: s.name,
attributes: s.attributes, attributes: s.attributes,
@ -329,7 +329,7 @@ watch(
</template> </template>
<div <div
v-if="tempStep.length === 0" v-if="tempStep?.length === 0"
class="row surface-1 rounded bordered items-center justify-center col" class="row surface-1 rounded bordered items-center justify-center col"
:class="{ :class="{
'q-ma-lg': $q.screen.gt.sm, 'q-ma-lg': $q.screen.gt.sm,
@ -378,8 +378,8 @@ watch(
<div class="full-width flex items-center"> <div class="full-width flex items-center">
<q-icon <q-icon
v-if=" v-if="
tempStep[stepIndex].attributes.properties.length === tempStep[stepIndex].attributes.properties?.length ===
propertiesOption.length propertiesOption?.length
" "
name="mdi-checkbox-marked" name="mdi-checkbox-marked"
size="xs" size="xs"
@ -432,7 +432,7 @@ watch(
</span> </span>
<div <div
v-if="tempStep[stepIndex].attributes.properties.length === 0" v-if="tempStep[stepIndex].attributes?.properties?.length === 0"
class="row surface-1 rounded bordered items-center justify-center col" class="row surface-1 rounded bordered items-center justify-center col"
:class="{ :class="{
'q-ma-lg': $q.screen.gt.sm, 'q-ma-lg': $q.screen.gt.sm,
@ -442,7 +442,7 @@ watch(
<NoData useField /> <NoData useField />
</div> </div>
<div <div
v-if="tempStep[stepIndex].attributes.properties.length > 0" v-if="tempStep[stepIndex].attributes?.properties?.length > 0"
class="q-py-sm" class="q-py-sm"
:class="{ :class="{
'q-px-lg': $q.screen.gt.sm, 'q-px-lg': $q.screen.gt.sm,
@ -474,7 +474,7 @@ watch(
flat flat
round round
:size="$q.screen.xs ? 'xs' : ''" :size="$q.screen.xs ? 'xs' : ''"
:disable="propIndex === tempStep.length - 1" :disable="propIndex === tempStep?.length - 1"
style="color: hsl(var(--text-mute-2))" style="color: hsl(var(--text-mute-2))"
@click="moveItemDown(tempStep, propIndex)" @click="moveItemDown(tempStep, propIndex)"
/> />