With the increase of the penetration rate of renewable energy power generation in the power system, the power grid gradually tends to be weak. Under the scenario of nonlinear load connecting to weak power grid, the grid-side voltage will produce unbalance, distortion and frequency deviation due to the influence of large internal impedance, insufficient inertia, three-phase current unbalance and harmonics of weak power grid. The operation of active power filters (APF) under above conditions can lead to significant degradation in harmonic compensation performance. An adaptive proportional integral (PI) + vector PI (VPI) harmonic compensation strategy for a three-phase APF is proposed for use in complex conditions of weak grid. The strategy consists of an adaptive notch filter based synchronous phase-locked loop (ANF-PLL) and an adaptive PI + VPI current control method. In this strategy, a series of adaptive lattice notch filters are introduced to improve the accuracy of grid phase and frequency estimation under the condition of voltage unbalance, distortion and a large range of frequency deviation. Then the phase and frequency information are used in the Park transformation of harmonic detection and current compensation control and the update of PI + VPI current control law parameters. A VPI current tracking controller with adaptive resonant frequency is constructed, which can improve the gain of the resonant frequency point and ensure that the APF can maintain the best compensation performance under the above weak grid conditions. Finally, the simulation and experimental results indicate that the ANF-PLL shows a better phase and frequency estimation performance under complex conditions of weak grid than the conventional and notch filter based methods, and the harmonic compensation strategy presented in this paper achieves a significant performance improvement under complex conditions of weak grid compared with Fixed VPI/SRF-PLL strategy and adaptive VPI/NF-PLL strategy.