A method for data transmission in a wireless network, comprising: determining, by a terminal device, first configuration information, wherein the first configuration information is used to determine at least one first sidelink logical channel, and the first sidelink logical channel is used to transmit direct communication data; determining, by the terminal device, whether type-1 data and type-2 data need to be transmitted at a same time, when the terminal device determines that type-1 data and type-2 data need to be transmitted at the same time, allocating, by the terminal device, a first transmit power for first data based on the first configuration information, wherein the type-1 data and the type-2 data are service data of different types which are to be transmitted by using different transmission resources, and the first data is the type-1 data to be transmitted by using the first sidelink logical channel, wherein the first configuration information comprises at least one first identifier, the first identifier is a priority identifier or a logical channel identifier, and the first identifier is used to determine the first sidelink logical channel; and wherein the first identifier is used to determine the first sidelink logical channel comprises: the terminal device determines a sidelink logical channel having the first identifier as the first sidelink logical channel; or when at least one of sidelink logical channels associated with data encapsulated in a protocol data unit of the terminal device has the first identifier, the terminal device determines all the sidelink logical channels associated with the data encapsulated in the protocol data unit as the first sidelink logical channels, wherein the allocating, by the terminal device, a first transmit power for first data based on the first configuration information comprises: allocating, by the terminal device, the first transmit power for the first data based on a first limited power, wherein the first transmit power is higher than the first limited power and lower than or equal to a maximum transmit power currently allowed by the terminal device, or the first transmit power is lower than or equal to the first limited power, characterized by the first limited power having a mapping relationship with the first identifier and being used to indicate a maximum available transmit power for data on a sidelink logical channel indicated by the first identifier. determining, by a terminal device, first configuration information, wherein the first configuration information is used to determine at least one first sidelink logical channel, and the first sidelink logical channel is used to transmit direct communication data; determining, by the terminal device, whether type-1 data and type-2 data need to be transmitted at a same time, when the terminal device determines that type-1 data and type-2 data need to be transmitted at the same time, allocating, by the terminal device, a first transmit power for first data based on the first configuration information, wherein the type-1 data and the type-2 data are service data of different types which are to be transmitted by using different transmission resources, and the first data is the type-1 data to be transmitted by using the first sidelink logical channel, wherein the first configuration information comprises at least one first identifier, the first identifier is a priority identifier or a logical channel identifier, and the first identifier is used to determine the first sidelink logical channel; and wherein the first identifier is used to determine the first sidelink logical channel comprises: the terminal device determines a sidelink logical channel having the first identifier as the first sidelink logical channel; or when at least one of sidelink logical channels associated with data encapsulated in a protocol data unit of the terminal device has the first identifier, the terminal device determines all the sidelink logical channels associated with the data encapsulated in the protocol data unit as the first sidelink logical channels, the terminal device determines a sidelink logical channel having the first identifier as the first sidelink logical channel; or when at least one of sidelink logical channels associated with data encapsulated in a protocol data unit of the terminal device has the first identifier, the terminal device determines all the sidelink logical channels associated with the data encapsulated in the protocol data unit as the first sidelink logical channels, wherein the allocating, by the terminal device, a first transmit power for first data based on the first configuration information comprises: allocating, by the terminal device, the first transmit power for the first data based on a first limited power, wherein the first transmit power is higher than the first limited power and lower than or equal to a maximum transmit power currently allowed by the terminal device, or the first transmit power is lower than or equal to the first limited power, characterized by the first limited power having a mapping relationship with the first identifier and being used to indicate a maximum available transmit power for data on a sidelink logical channel indicated by the first identifier.