I would tend to think of using an inline mains connector plug and socket to replace the existing plug, however this is effectively an extension lead.
View attachment 48663
Generally it is not easy to replace the entire cable as the internal connections in the vacuum cleaner are not readily accessible and may not be removable.