An electronic device comprising: a device body comprising a first accommodating space, a second accommodating space, and a first opening in communication with the first accommodating space, wherein the second accommodating space is in communication with the first accommodating space; a functional module comprising a first state and a second state; an ejection mechanism comprising a connecting rod, a slider, and a driving part, wherein the functional module is detachably connected to the slider, and a guide rail is disposed on the slider, wherein the guide rail comprises a first limiting section, an extending section, a second limiting section and a retracting section connected in sequence; at least a part of the driving parts is disposed inside the second accommodating space, the driving parts drives the slider to move along a direction perpendicular to the first opening, a first end of the connecting rod is hinged to an inner wall of the second accommodating space, and a second end of the connecting rod is slidably matched with the guide rail; in a case that the functional module is in the first state, the functional module is separated from the slider; in a case that the functional module is in the second state, the functional module is connected to the slider, and the slider is movable between a first position and a second position, when the slider is located at the first position, the slider is located inside the second accommodating space, and when the slider is located at the second position, at least a part of the slider is located outside the second accommodating space; in a case that the slider is located at the second position, at least a part of the functional module is located outside the first accommodating space, and the second end of the connecting rod is matched with the first limiting section; and in a case that the slider is located at the first position, the functional module is located inside the first accommodating space, and the second end of the connecting rod is matched with the second limiting section. a device body comprising a first accommodating space, a second accommodating space, and a first opening in communication with the first accommodating space, wherein the second accommodating space is in communication with the first accommodating space; a functional module comprising a first state and a second state; an ejection mechanism comprising a connecting rod, a slider, and a driving part, wherein the functional module is detachably connected to the slider, and a guide rail is disposed on the slider, wherein the guide rail comprises a first limiting section, an extending section, a second limiting section and a retracting section connected in sequence; at least a part of the driving parts is disposed inside the second accommodating space, the driving parts drives the slider to move along a direction perpendicular to the first opening, a first end of the connecting rod is hinged to an inner wall of the second accommodating space, and a second end of the connecting rod is slidably matched with the guide rail; in a case that the functional module is in the first state, the functional module is separated from the slider; in a case that the functional module is in the second state, the functional module is connected to the slider, and the slider is movable between a first position and a second position, when the slider is located at the first position, the slider is located inside the second accommodating space, and when the slider is located at the second position, at least a part of the slider is located outside the second accommodating space; in a case that the slider is located at the second position, at least a part of the functional module is located outside the first accommodating space, and the second end of the connecting rod is matched with the first limiting section; and in a case that the slider is located at the first position, the functional module is located inside the first accommodating space, and the second end of the connecting rod is matched with the second limiting section.