There is much debate over why dogs eat grass and then like to vomit afterwards.
One theory is that the dog may have an upset stomach, and so eats the grass blades which then irritate the digestive system and causing vomiting to happen. Another theory is that the dogs are eating grass to mimic a "lost nutrient" of their ancestors found usually by hunting and then eating the contents of the stomachs of herbivores. A third theory is that dogs just do it because to them, it's fun and they can.
If your dog has been vomiting a lot recently, either related to or unrelated to eating grass, then it is always a good idea to schedule a wellness exam with your vet to make sure there are not any issues causing illness. Grass, especially in areas where livestock may graze can also be a host for parasite eggs, which can, in turn, infect your dog with an internal parasite (and thus cause vomiting and diarrhea).
If your dog is not eating at all, this is more concerning and points further to some digestive upset causing his or her symptoms. Making an appointment with your vet as well as bringing in a sample of his or her stool is best for helping your pet feel better.