Abstract Fractal phenomena may be widely observed in a great number of complex systems. In this paper, motivated by the well-known Vicsek fractal, we propose the generalized Vicsek fractal whose seed is not necessarily a single edge but an arbitrary tree, and study random walks on it for the purpose of understanding how the underlying topology influences dynamic behaviors. Meanwhile, we determine the exact solution to the mean first-passage time for random walks on the generalized version in a more convenient mapping-based manner, while other methods suitable for the typical Vicsek fractal will become prohibitively complicated and even fail in this kind of situation. The analytic results suggest that the scaling relation between mean first-passage time and vertex number in generalized versions of Vicsek fractal keeps unchanged in the large graph size limit. Lastly, we conduct extensive computer simulations, and observe that experimental results are well consistent with the theoretical analysis.