For a DC quadrupole magnet, the normalized magnetic field distribution along the beam trajectory is mainly determined by the mechanical structure of the magnet and remains almost independent of the exciting current. However, the magnetic field measurement results of the Rapid Cycling Synchrotron (RCS) at the China Spallation Neutron Source (CSNS) show that the normalized magnetic field distribution along the beam trajectory varies during the exciting current ramping process for rapid ramping magnets. Consequently, for rapid ramping quadrupole magnets, there are significant differences between the dynamic and static magnetic field gradient distribution. And the changes in the distribution of the magnetic field gradient can cause time dependent tune-shifts during the exciting current ramping process. For RCS, the tune is crucial, and the shifts of tune may lead to the beam approaching the resonance line, thereby causing beam loss. The impact of the fringe field effect of the rapid ramping quadrupole magnets on beam dynamics at CSNS-RCS was detailly studied. A new method for correcting the time-dependent tune shifts caused by the dynamic field distribution, based on waveform compensation at the quadrupole magnets, has also been proposed for the RCS of CSNS. Related simulation and experiment have been conducted, and the simulation results and experimental results are consistent with theoretical study results.