We study the transverse momentum spectra ofJ/ψandΥmesons by using two methods: the two-component Erlang distribution and the two-component Schwinger mechanism. The results obtained by the two methods are compared and found to be in agreement with the experimental data of proton-proton (pp), proton-lead (p-Pb), and lead-lead (Pb-Pb) collisions measured by the LHCb and ALICE Collaborations at the large hadron collider (LHC). The related parameters such as the mean transverse momentum contributed by each parton in the first (second) component in the two-component Erlang distribution and the string tension between two partons in the first (second) component in the two-component Schwinger mechanism are extracted.