目前,我已經創建了一個授權組件,該組件在接受對表單所做的新更改之前檢查本地 AD 用戶名/密碼。用戶單擊“身份驗證”后,該函數需要幾秒鐘的時間才能驗證用戶。由于該按鈕不會動畫或消失,因此用戶可以多次單擊它,從而導致問題。我正在嘗試對此按鈕實現簡單的淡入淡出/動畫,但很難實現一些建議。如果您對如何實現或要研究哪些 React 插件有任何建議,我們將不勝感激。 <DialogActions> <Button onClick={() => props.onClose(ConfirmationDialogButtons.CANCEL)} color="primary"> Cancel </Button> <Button onClick={handleSign} color="primary"> Authenticate </Button> </DialogActions>這是 onClick={handleSign} 代碼。const handleSign = async () => { const srv = new DataServer() const result = await srv.eSignature(formData.userId, formData.password, props.securityArea, props.prompt, formData.comment) if(result.error === 0) { sessionStorage.setItem("Authenticated" , JSON.stringify({Authenticated : true , time : new Date()})) props.onClose(ConfirmationDialogButtons.OK) } else { setSignError(result.error) } }
在 React 組件中為 <Button> 添加淡入淡出/動畫
烙印99
2023-07-06 18:23:48