A beam configuration method applied to an electronic device, wherein the electronic device comprises a first plane, the first plane comprises at least two antenna array units, and the method comprises: determining whether an included angle between a ray that is perpendicular to the first plane and that extends outward from the electronic device and a ray pointing from the electronic device to a peer device is less than or equal to a preset angle; and when the included angle between the ray that is perpendicular to the first plane and that extends outward from the electronic device and the ray pointing from the electronic device to the peer device is less than or equal to the preset angle, performing end-fire state configuration on the antenna array units in the first plane, so that a first beam is in a same direction as a normal line of the first plane, wherein the first beam is a beam formed by the antenna array units in the first plane, wherein the electronic device further comprises M other planes, at least two antenna array units are configured for each of the M other planes, M is an integer greater than zero, and when the included angle between the ray that is perpendicular to the first plane and that extends outward from the electronic device and the ray pointing from the electronic device to the peer device is less than or equal to the preset angle, the method further comprises: when an n th other plane of the M other planes is perpendicular to the first plane, performing broadside state configuration on antenna array units in the n th other plane, so that an n th other beam is in a same direction as a perpendicular line of a normal line of the n th other plane; or when an n th other plane of the M other planes is parallel to the first plane, configuring antenna array units in the n th other plane to be in a non-operating state. determining whether an included angle between a ray that is perpendicular to the first plane and that extends outward from the electronic device and a ray pointing from the electronic device to a peer device is less than or equal to a preset angle; and when the included angle between the ray that is perpendicular to the first plane and that extends outward from the electronic device and the ray pointing from the electronic device to the peer device is less than or equal to the preset angle, performing end-fire state configuration on the antenna array units in the first plane, so that a first beam is in a same direction as a normal line of the first plane, wherein the first beam is a beam formed by the antenna array units in the first plane, wherein the electronic device further comprises M other planes, at least two antenna array units are configured for each of the M other planes, M is an integer greater than zero, and when the included angle between the ray that is perpendicular to the first plane and that extends outward from the electronic device and the ray pointing from the electronic device to the peer device is less than or equal to the preset angle, the method further comprises: when an n th other plane of the M other planes is perpendicular to the first plane, performing broadside state configuration on antenna array units in the n th other plane, so that an n th other beam is in a same direction as a perpendicular line of a normal line of the n th other plane; or when an n th other plane of the M other planes is parallel to the first plane, configuring antenna array units in the n th other plane to be in a non-operating state. when an n th other plane of the M other planes is perpendicular to the first plane, performing broadside state configuration on antenna array units in the n th other plane, so that an n th other beam is in a same direction as a perpendicular line of a normal line of the n th other plane; or when an n th other plane of the M other planes is parallel to the first plane, configuring antenna array units in the n th other plane to be in a non-operating state.