The short answer is “yes they can” – and better that most ICE cars. What stands in the way is a combination of manufacturer laziness and lack of available of hardware.
Most electric vehicles owners have rooftop solar, and many of them have installed it just to charge their EV. One quarter also have household batteries.