I remember a weighted sum was used when I was a child, at least used in the USSR. A gold medal was worth 3 points, silver 2, bronze 1. There is too much room here for an arbitrary distrubution of weights between medals (why is one silver medal worth two bronze ones?)
The componentwise sorting ("lexicographical sort", in computer parlance) sounds a bit more reasonable to me, perhaps because I am more used to it. (Not the right place to start another computer science versus mathematics religious war.) The official olympic site sorts the medals in the order: gold, silver, bronze. It also separately counts the standings of the total medal count. This skews the results so that for a while Norway, which had substantially more medals than any other country, but only one gold, was standing below Estonia, which had a total of two medals, all gold.
I think a better way would be to sort the medals in the following order: total count, gold count, silver count, bronze count. (Of course, the last component would be superfluous.) Obviously, the total count is sorted in the ascending order, the rest in the descending order. It seems that at least one of the sources
Further improvement may be needed to avoid counting medals of all values as the same for the total. That is, instead of counting one bronze or one silver or one gold equally for the total, one could introduce a weighted total. Again, the problem here would be it is too arbitrary.
Disclaimer. I don't really care.