From bba7f24672294afde6c00e1bed4e5f8546b35374 Mon Sep 17 00:00:00 2001 From: Cindy Chang Date: Wed, 10 Jul 2024 10:40:15 +0800 Subject: [PATCH] fix: #319 add watch of inputConfirmPwd inside onMounted --- src/stores/modal.js | 3 +- .../ModalAccountEditCreate.vue | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/stores/modal.js b/src/stores/modal.js index 89481e9..71bb056 100644 --- a/src/stores/modal.js +++ b/src/stores/modal.js @@ -13,9 +13,8 @@ export const useModalStore = defineStore('modalStore', { this.whichModal = whichModal; }, async closeModal(){ - console.log("Start closing modal"); + await delaySecond(2); this.isModalOpen = false; - console.log("Modal closed"); }, }, }); \ No newline at end of file diff --git a/src/views/AccountManagement/ModalAccountEditCreate.vue b/src/views/AccountManagement/ModalAccountEditCreate.vue index 6c86611..65d47ae 100644 --- a/src/views/AccountManagement/ModalAccountEditCreate.vue +++ b/src/views/AccountManagement/ModalAccountEditCreate.vue @@ -199,9 +199,28 @@ export default defineComponent({ const shouldDisalbeConfirmButton = (inputAccountToTest, inputNameToTest, inputPasswordToTest, inputConfirmPwdToTest, inputPwdMatchedToTest, ) => { + console.log('inputAccountToTest?.length', inputAccountToTest?.length); return !inputAccountToTest?.length || !inputNameToTest?.length || !inputPasswordToTest?.length || !inputConfirmPwdToTest?.length || !inputPwdMatchedToTest; } + + // watch( TODO:暫時註解 + // [inputUserAccount, inputName, inputPwd, inputConfirmPwd, + // isPwdMatched, + // ], + // async ([newAccount, newName, newPwd, newConfirmPwd, + // newPwdMatched, + // ]) => { + + // if (validateInputLengthAndEquality(newAccount, newName, newPwd, newConfirmPwd, newPwdMatched)) { + // isConfirmDisabled.value = true; + // } else { + // isConfirmDisabled.value = false; + // } + // }, + // { immediate: true } + // ); + const togglePwdEyeBtn = () => { isPwdEyeOn.value = !isPwdEyeOn.value; @@ -279,6 +298,17 @@ export default defineComponent({ } } const onInputAccountFocus = async() => { + // if(!isAccountUnique.value) { + // // 之所以要轉回true,是為了讓使用者可以繼續填寫不被阻擋 + // isAccountUnique.value = true; + // } + // if(isConfirmDisabled.value){ + // // 所有欄位都要填寫,confirm按鈕才可點選 + // if(validateInputLengthAndEquality(inputUserAccount.value, inputName.value, inputPwd.value, inputConfirmPwd.value, isPwdMatched.value) + // ){ + // isConfirmDisabled.value = false; + // } + // } } const onInputNameFocus = () => {