  The novel physics of twisted bilayer graphene has motivated extensive studies
of magic-angle flat bands hosted by moir\'e structures in electronic, photonic
and acoustic systems. On the other hand, bound states in the continuum (BICs)
have also attracted great attention in recent years because of their potential
applications in the field of designing superior optical devices. Here, we
combine these two independent concepts to construct a new optical state in a
twisted bilayer photonic crystal slab, which is called as moir\'e quasi-BIC,
and numerically demonstrate that such an exotic optical state possesses dual
characteristics of moir\'e flat bands and quasi-BICs. To illustrate the
mechanism for the formation of moir\'e flat bands, we develop an effective
model at the center of the Brillouin zone and show that moir\'e flat bands
could be fulfilled by balancing the interlayer coupling strength and the twist
angle around the band edge above the light line. Moreover, by decreasing the
twist angle of moir\'e photonic crystal slabs with flat bands, it is shown that
the moir\'e flat-band mode at the Brillouin center gradually approaches a
perfect BIC, where the total radiation loss from all diffraction channels is
significantly suppressed. To clarify the advantage of moir\'e quasi-BICs,
enhanced second-harmonic generation (SHG) is numerically proven with a
wide-angle optical source. The efficiency of SHG assisted by designed moir\'e
quasi-BICs can be greatly improved compared with that based on dispersive
quasi-BICs with similar quality factors.
