A connector, configured to connect a first electronic component and a second electronic component, and comprising: an enclosure, wherein a through-hole is disposed on the enclosure; a pin assembly, wherein the pin assembly is disposed in the enclosure, the pin assembly is movable relative to the enclosure, the pin assembly comprises a fixing frame, and a pin is disposed on the fixing frame; a flexible printed circuit board, wherein one end of the flexible printed circuit board is connected to the pin, and the other end of the flexible printed circuit board is configured to be connected to a circuit board in the first electronic component; a plug structure, wherein the plug structure is configured to be detachably connected to the second electronic component; and a driving assembly, wherein when the second electronic component is connected to the plug structure, the driving assembly is able to drive the pin assembly to move relative to the enclosure in a direction close to the through-hole, so that the pin extends out of the through-hole and is connected to the second electronic component; wherein the driving assembly comprises a first magnet fixed on the fixing frame; the first magnet is configured to match a second magnet in the second electronic component; the through-hole is opened on an upper cover of the enclosure; and when the second electronic component is connected to the plug structure, attractive force between the first magnet and the second magnet is able to drive the first magnet and the pin assembly to move close to the through-hole; wherein an elastic component is disposed between the pin assembly and the enclosure and the elastic component is a spring. an enclosure, wherein a through-hole is disposed on the enclosure; a pin assembly, wherein the pin assembly is disposed in the enclosure, the pin assembly is movable relative to the enclosure, the pin assembly comprises a fixing frame, and a pin is disposed on the fixing frame; a flexible printed circuit board, wherein one end of the flexible printed circuit board is connected to the pin, and the other end of the flexible printed circuit board is configured to be connected to a circuit board in the first electronic component; a plug structure, wherein the plug structure is configured to be detachably connected to the second electronic component; and a driving assembly, wherein when the second electronic component is connected to the plug structure, the driving assembly is able to drive the pin assembly to move relative to the enclosure in a direction close to the through-hole, so that the pin extends out of the through-hole and is connected to the second electronic component; wherein the driving assembly comprises a first magnet fixed on the fixing frame; the first magnet is configured to match a second magnet in the second electronic component; the through-hole is opened on an upper cover of the enclosure; and when the second electronic component is connected to the plug structure, attractive force between the first magnet and the second magnet is able to drive the first magnet and the pin assembly to move close to the through-hole; wherein an elastic component is disposed between the pin assembly and the enclosure and the elastic component is a spring.