feature: acct list can hover pencil btn

This commit is contained in:
Cindy Chang
2024-06-21 13:17:24 +08:00
parent 1b8c8629a9
commit ad8c555632
7 changed files with 103 additions and 45 deletions

View File

@@ -43,6 +43,7 @@ export default defineStore('acctMgmtStore', {
const response = await this.$axios.get(apiGetUserList);
const customizedResponseData = await this.customizeAllUserList(response.data);
this.allUserAccoutList = customizedResponseData;
console.log('getAllUserAccounts success');
} catch(error) {
apiError(error, 'Failed to get all users.');
}
@@ -54,7 +55,8 @@ export default defineStore('acctMgmtStore', {
return rawResponseData.map(user => ({
...user, // 保留後端傳來的欄位
isDeleteHovered: false, // 針對前端顯示而額外增加的欄位
isRowHovered: true,
isRowHovered: false,
isEditHovered: false,
}));
},
/**
@@ -79,5 +81,16 @@ export default defineStore('acctMgmtStore', {
userToChange.isRowHovered = isRowHovered;
}
},
/**
* According to mouseover or mouseleave status, change the bool value.
* @param {string} username
* @param {boolean} isEditHovered
*/
changeIsEditHoveredByUser(username, isEditHovered) {
const userToChange = this.allUserAccoutList.find(user => user.username === username);
if (userToChange) {
userToChange.isEditHovered = isEditHovered;
}
},
},
})