A head-mounted electronic device comprises two earphones (10), one wrapping member (20), and two display members (30). The wrapping member is connected to the two earphones and is used for wrapping a space in front of the eyes of a user. The wrapping member comprises a dimming portion (24) that is located in front of the eyes and whose transparency can be changed. Each display member is rotatably connected to one corresponding earphone and can rotate to a first position in front of the eyes and a second position staggered with the eyes. At the first position, the dimming portion is in a light shading state and display members project images to the eyes of the user. At the second position, the dimming element is in a light transmission state and the display members project images to the dimming portion, so that the user can see external scenes and projected images. Without taking off the head-mounted electronic device, a user can conveniently switch between watching images displayed on the head-mounted electronic device and watching environmental scenes outside the head-mounted electronic device, thereby bringing great convenience to the user and improving the experience feeling of the user.