Trump has tried to draw parallels between his campaign, which has a strong nationalist message, and Britain's vote to leave the EU.