Zoey did that few times on different occasions.
1. She eats grass sometimes and vomits yellow bile later. (sometimes vomits containing grass, sometimes not)
2. Some treat I give her doesn't agree with her tummy.
3. She's hungry.
4. WAY overly excited and/or spent too much energy running around.
If she vomits, I don't give her any treats for a day or so and feed her blend food for couple days. Like boiled chicken breast and rice. I think yorkies are known to sensitive tummies. Of course, if I see any other signs of her not being well, I'd take her to the vet right away. If not, the blend food and no treats have been working.
Oh~ I forgot to mention, if your pup vomits, make sure he's kept hydrated. I keep a bottle a pedialyte just in case.