From my understanding, mass participation for each mode is determined
by the general mass and the eigenvector of the mode, and eigenvector
of the mode usually consists of contribution from all the $x$, $y$ and
$z$ direction, so how can one tell whether the mode is contributed
to lateral or vertical direction?
That is correct in general, but for a simple and very symmetrical frame model like your drawing it is quite likely that the lowest frequency modes of the response will either be a mainly lateral "swaying" or "twisting" motion, or a mainly vertical "pogo stick" motion.
In that situation, you can decide whether the modal mass participation is "mainly vertical" or "mainly lateral" simply by looking at plots of the mode shapes.
The higher frequency mode shapes will tend to be more localized, and have more cross-coupling between "lateral" and "vertical" motion, but in a simple model they may be too inaccurate to be of much practical value.
Calculating more "accurate" values instead of the zeros shown in the table may not add much value to understanding how the structure behaves, especially in a text-book example, because the differences between the real structure and the simple model may be greater than the errors in taking the "small" mass participation factors as zero.
After splitting the modes into two groups in this way, you can (approximately) consider the effect of vertical and lateral base loading independently.