입력 전처리
All checks were successful
LocalNet_front/pipeline/head This commit looks good

This commit is contained in:
dyhj625 2025-04-04 13:08:20 +09:00
parent b2deb1ade2
commit f6365e6b31

View File

@ -64,7 +64,7 @@
<!-- 기존 비밀번호 입력 --> <!-- 기존 비밀번호 입력 -->
<UserFormInput title="기존 비밀번호" name="currentPw" type="password" <UserFormInput title="기존 비밀번호" name="currentPw" type="password"
:value="password.current" @update:data="password.current = $event" :value="password.current" @update:data="password.current = $event"
@blur="checkCurrentPassword" /> @blur="checkCurrentPassword" @keypress="noSpace" />
<span v-if="passwordError" class="text-danger invalid-feedback mt-1 d-block"> <span v-if="passwordError" class="text-danger invalid-feedback mt-1 d-block">
비밀번호가 일치하지 않습니다. 비밀번호가 일치하지 않습니다.
</span> </span>
@ -72,7 +72,7 @@
<!-- 비밀번호 재설정 --> <!-- 비밀번호 재설정 -->
<div v-if="showResetPw"> <div v-if="showResetPw">
<UserFormInput title="새 비밀번호" name="newPw" type="password" <UserFormInput title="새 비밀번호" name="newPw" type="password"
:value="password.new" @update:data="password.new = $event" /> :value="password.new" @update:data="password.new = $event" @keypress="noSpace" />
<span v-if="password.new && password.new.length < 4" <span v-if="password.new && password.new.length < 4"
class="text-danger invalid-feedback mt-1 d-block"> class="text-danger invalid-feedback mt-1 d-block">
비밀번호는 최소 4자리 이상이어야 합니다. 비밀번호는 최소 4자리 이상이어야 합니다.
@ -83,7 +83,7 @@
</span> </span>
<UserFormInput title="비밀번호 확인" name="confirmPw" type="password" <UserFormInput title="비밀번호 확인" name="confirmPw" type="password"
:value="password.confirm" @update:data="password.confirm = $event" /> :value="password.confirm" @update:data="password.confirm = $event" @keypress="noSpace" />
<span v-if="password.confirm && password.confirm !== password.new" <span v-if="password.confirm && password.confirm !== password.new"
class="text-danger invalid-feedback mt-1 d-block"> class="text-danger invalid-feedback mt-1 d-block">
비밀번호와 일치하지 않습니다. 비밀번호와 일치하지 않습니다.
@ -111,7 +111,7 @@
</template> </template>
<script setup> <script setup>
import { ref, computed, onMounted } from 'vue'; import { ref, computed, onMounted, watch} from 'vue';
import $api from '@api'; import $api from '@api';
import UserFormInput from '@c/input/UserFormInput.vue'; import UserFormInput from '@c/input/UserFormInput.vue';
import FormSelect from '@c/input/FormSelect.vue'; import FormSelect from '@c/input/FormSelect.vue';
@ -120,6 +120,10 @@ import { useToastStore } from '@s/toastStore';
const toastStore = useToastStore(); const toastStore = useToastStore();
const noSpace = (e) => {
if (e.key === ' ') e.preventDefault();
};
const form = ref({ const form = ref({
entryDate: '', birth: '', phone: '', color: '', mbti: '', entryDate: '', birth: '', phone: '', color: '', mbti: '',
address: { address: '', detailAddress: '', postcode: '' }, address: { address: '', detailAddress: '', postcode: '' },
@ -148,6 +152,15 @@ return (
); );
}); });
watch(
() => form.value.address.detailAddress,
(newVal) => {
if (newVal !== newVal.trim()) {
form.value.address.detailAddress = newVal.trim();
}
}
);
const isChanged = computed(() => { const isChanged = computed(() => {
const f = form.value; const f = form.value;
const o = originalData.value; const o = originalData.value;