I have a mail account like email@example.com. Due to slow working and non-responding computer, I accidentally erased my inbox and trash on iCloud.
Is there any option that I can recover them?
You say "computer" but don't specify what, I will assume that you mean you have a Mac also, in which case, on the assumption that you run Time Machine (please, everyone, make backups!) then offline copies should be in your backups.
Try logging into icloud.com with your Apple ID and password. If the messages are no longer there, then there is no recovery option.