can anyone explain to me how the erc20Votes prevent double voting

What do you mean by double voting exactly? As it is designed now it works with voting weight, meaning account can cast more than weight = 1 in votes.

"Double voting" means that a voter would be able to use their tokens twice for the same proposal. A naive implementation of ERC20 votes is vulnerable to that attack by voting, transferring the tokens to another accont and then voting again from that other account.

ERC20Votes protects from double voting by keeping a history of voting power at every block. So proposals choose a starting block where voting power will be counted, and transfers that happen after that block have no effect.