This paper presents a novel microgrid secondary control method based on distributed sliding mode control, addressing the issue of reactive power sharing in islanded microgrids. Acknowledging the complications posed by feeder impedance mismatch, the traditional droop control mechanism fails to facilitate efficient reactive power sharing. Utilizing a distributed framework, this paper initially introduces a reactive power ratio observer, enabling the observation of global average reactive power without the need for precise reactive power calculation as required in a conventional centralized control setup. Subsequently, employing the devised reactive power ratio observer, sliding mode control is integrated to achieve effective reactive power sharing. Furthermore, this paper broadens its scope to encompass both reactive power sharing and voltage restoration, resulting in the design of a comprehensive controller. Notably, the proposed distributed sliding mode controller not only achieves accurate reactive power sharing but also exhibits significant resilience in the face of load disturbances. The simulation results conducted under various scenarios effectively validate the efficacy of the proposed distributed sliding mode control strategy.