fix: #318 enable confirm button when newPwd or newConfirmPwd is changed
This commit is contained in:
@@ -197,30 +197,15 @@ export default defineComponent({
|
|||||||
return modalStore.whichModal === MODAL_CREATE_NEW ? i18next.t('AcctMgmt.CreateNew') : i18next.t('AcctMgmt.AccountEdit');
|
return modalStore.whichModal === MODAL_CREATE_NEW ? i18next.t('AcctMgmt.CreateNew') : i18next.t('AcctMgmt.AccountEdit');
|
||||||
});
|
});
|
||||||
|
|
||||||
const shouldDisalbeConfirmButton = (inputAccountToTest, inputNameToTest, inputPasswordToTest, inputConfirmPwdToTest, inputPwdMatchedToTest,
|
const hasAtLeastOneEmptyField = (inputAccountToTest, inputNameToTest, inputPasswordToTest, inputConfirmPwdToTest) => {
|
||||||
) => {
|
|
||||||
console.log('inputAccountToTest?.length', inputAccountToTest?.length);
|
|
||||||
return !inputAccountToTest?.length || !inputNameToTest?.length || !inputPasswordToTest?.length
|
return !inputAccountToTest?.length || !inputNameToTest?.length || !inputPasswordToTest?.length
|
||||||
|| !inputConfirmPwdToTest?.length || !inputPwdMatchedToTest;
|
|| !inputConfirmPwdToTest?.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
// watch( TODO:暫時註解
|
const shouldDisalbeConfirmButton = (inputAccountToTest, inputNameToTest, inputPasswordToTest, inputConfirmPwdToTest, inputPwdMatchedToTest,
|
||||||
// [inputUserAccount, inputName, inputPwd, inputConfirmPwd,
|
) => {
|
||||||
// isPwdMatched,
|
return hasAtLeastOneEmptyField(inputAccountToTest, inputNameToTest, inputPasswordToTest, inputConfirmPwdToTest) || !inputPwdMatchedToTest;
|
||||||
// ],
|
}
|
||||||
// async ([newAccount, newName, newPwd, newConfirmPwd,
|
|
||||||
// newPwdMatched,
|
|
||||||
// ]) => {
|
|
||||||
|
|
||||||
// if (validateInputLengthAndEquality(newAccount, newName, newPwd, newConfirmPwd, newPwdMatched)) {
|
|
||||||
// isConfirmDisabled.value = true;
|
|
||||||
// } else {
|
|
||||||
// isConfirmDisabled.value = false;
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// { immediate: true }
|
|
||||||
// );
|
|
||||||
|
|
||||||
|
|
||||||
const togglePwdEyeBtn = () => {
|
const togglePwdEyeBtn = () => {
|
||||||
isPwdEyeOn.value = !isPwdEyeOn.value;
|
isPwdEyeOn.value = !isPwdEyeOn.value;
|
||||||
@@ -335,8 +320,8 @@ export default defineComponent({
|
|||||||
([newPwd, newConfirmPwd]) => {
|
([newPwd, newConfirmPwd]) => {
|
||||||
isPwdMatched.value = newPwd === newConfirmPwd && newPwd.length;
|
isPwdMatched.value = newPwd === newConfirmPwd && newPwd.length;
|
||||||
// 只要[確認密碼]或[密碼]有更動,confirm 按鈕就可點選
|
// 只要[確認密碼]或[密碼]有更動,confirm 按鈕就可點選
|
||||||
if (newPwd || newConfirmPwd) {
|
if ((newPwd || newConfirmPwd) && inputUserAccount.length && inputName.length) {
|
||||||
// isConfirmDisabled.value = false;
|
isConfirmDisabled.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user