An electronic device, comprising a first body and a second body, the first body comprising a first case and a magnetic member disposed inside the first case, the second body comprising a second case and comprising a magnetic sensor and a switch control component which are disposed inside the second case, the second case movably connected to the first body, the switch control component electrically connected to the magnetic sensor, wherein: the second body comprising a magnetism guiding member disposed inside the second case, the magnetic sensor disposed on the magnetism guiding member, the second case of the second body has an upper surface, the magnetic sensor is located between the upper surface and the magnetism guiding member, such that the magnetic sensor is located between the magnetic member and the magnetism guiding member when the first case of the first body is closed on the second case of the second body, the magnetism guiding member configured to guide a magnetic field caused by the magnetic member, and the magnetic sensor configured to detect a magnetic flux caused by the magnetic member, wherein when the magnetic flux of the magnetic member detected by the magnetic sensor is larger than a first value, the switch control component is configured to control the switching-on-or-off of an electronic component, and the magnetism guiding member comprises a permeance body and an extended member (232a, 232b, 232c, 232d, 232e), and the extended member extends from a side of the permeance body, an edge of the extended member on a side far from the permeance body comprises a first edge segment (S1a, S1b, S1c, S1d, S1e), a second edge segment (S2a, S2b, S2c, S2d, S2e) and a third edge segment (S3a, S3b, S3c, S3d, S3e), two ends of the second edge segment are respectively connected with the first edge segment and the third edge segment, the first edge segment and the third edge segment are connected with the permeance body, the first edge segment, the second edge segment and the third edge segment extend along the same plane, and an extension direction of the first edge segment and an extension direction of the third edge segment have an angle (θ2a, θ2b, θ2c, θ2d) therebetween, and a range of the angle is between 40 degrees and 130 degrees. the second body comprising a magnetism guiding member disposed inside the second case, the magnetic sensor disposed on the magnetism guiding member, the second case of the second body has an upper surface, the magnetic sensor is located between the upper surface and the magnetism guiding member, such that the magnetic sensor is located between the magnetic member and the magnetism guiding member when the first case of the first body is closed on the second case of the second body, the magnetism guiding member configured to guide a magnetic field caused by the magnetic member, and the magnetic sensor configured to detect a magnetic flux caused by the magnetic member, wherein when the magnetic flux of the magnetic member detected by the magnetic sensor is larger than a first value, the switch control component is configured to control the switching-on-or-off of an electronic component, and the magnetism guiding member comprises a permeance body and an extended member (232a, 232b, 232c, 232d, 232e), and the extended member extends from a side of the permeance body, an edge of the extended member on a side far from the permeance body comprises a first edge segment (S1a, S1b, S1c, S1d, S1e), a second edge segment (S2a, S2b, S2c, S2d, S2e) and a third edge segment (S3a, S3b, S3c, S3d, S3e), two ends of the second edge segment are respectively connected with the first edge segment and the third edge segment, the first edge segment and the third edge segment are connected with the permeance body, the first edge segment, the second edge segment and the third edge segment extend along the same plane, and an extension direction of the first edge segment and an extension direction of the third edge segment have an angle (θ2a, θ2b, θ2c, θ2d) therebetween, and a range of the angle is between 40 degrees and 130 degrees.