A power outage can sometimes damage a computer especially if the power suddenly goes off and then comes back on as a surge of power.
In some cases the power outage may mess up the hard drive and corrupt some data but it's rare it happens.
It's best to shut your computer down during a storm or when the power may go out to avoid any possible damage and use a surge protector and a UPS battery for your computer to keep the computer temporarily supplied with enough power.
If the power goes out while your computer is on and it's a desktop computer then all the data you have not saved to your hard drive will be lost.
If it's a laptop then the battery will keep the power supplied to the laptop.
If the power goes out while you're working on something on your desktop computer and you haven't saved it then yes that data will be lost when the power goes out.
So for example if you were writing something in notepad and didn't click save which you should do every so often then when the power goes out all that work will be lost.
But if the data is save don the computers hard drive then the data will still be there when the power goes out.
If you have a wordpress blog then it usually will save an auto draft of your article so if you lose your power or your computer crashes then your posts are automatically saved on the server.
If you think the power is gonna go out then save your information and then shut the computer down.
Then wait until the power comes back up for at least 10 minutes and then restart your computer.
I've had times where the power went out and I immediately started the computer back up as soon as the power came back on.
Then a minute or so later the power went out again.