"Should we get a Eurail pass or just purchase as we need."
Neither. A Eurail pass covers many countries and would be a ridiculous waste of money for just 3 trains. And while you can purchase at the last minute, it will cost you a lot for that flexibility. Since it sounds like your travel dates will be known in advance, you should purchase the tickets in advance.
For Italy, you can buy regional trains at the last minute with no "penalty." But faster (Freccia) trains will cost less if you buy non-refundable, non-exchangeable tickets in advance. For your routes, part of your travel is likely to be on faster trains, and part will definitely be on regional trains. You can use Trenitalia's website and look at trains within the next week (regionals are only loaded a week at a time). Put in Rome to Vernazza, then put in Vernazza to Ventimiglia, to see what the options are. From Ventimiglia, as Sam says, you will take a cheap regional French train to Nice. The Ventimiglia to Nice train runs twice an hour and is unreserved - just buy your ticket in Ventimiglia and hop on.
All of that said, last minute tickets for Italian trains aren't that expensive. But last minute French train tickets are. So, it's very important that you buy those early. To see what I mean, go to the SNCF website http://en.voyages-sncf.com/en/, and choose France as your ticket collection country. Look at prices on your route for tomorrow, and for 90 days out. As long as you can accept non-refundable and non-exchangeable tickets, you can save a fortune. Most likely, you will actually book on Capitaine Train https://www.capitainetrain.com/en, as it's easier to use and has the same prices as SNCF. A bonus of buying early: you can often get first class tickets for only a few more euros than second class.
Do not use Rail Europe for either prices (marked up) or routes and trains (not complete).