BIARRITZ, France — Remember when President Xi Jinping of China was the “enemy”? That was so Friday. As of Monday, according to President Trump, Mr. Xi was “a great leader” and a “brilliant man.”

What about that edict by Mr. Trump, who “hereby ordered” American companies to leave China? Three days later, he was positive he would get a trade deal and, if so, then firms should “stay there and do a great job.”

Mr. Trump spent the weekend in France insisting that he was not having a debate with his fellow world leaders, but at times it seemed like he was having a debate with himself. Day by day, even hour by hour, his approach to the trade war with China, the most consequential economic conflict on the planet, veered back and forth, leaving much of the world with geopolitical whiplash.

If he seemed all over the map, he made clear on Monday, as he wrapped up days of diplomacy, that the world would just have to get used to it. He likes leaving negotiating partners, adversaries, observers and even allies off balance.