Taro v3.0.0-rc.6,使用支付宝小程序原生第三方组件,在props中传入function不生效。



  • 如题,使用支付宝小程序时,通过usingComponent引用了支付宝小程序原生第三方组件,传入props中的string或者number可以生效,但是传入function无法被执行。原生小程序调用是没问题的。

    在Taro中使用:

        <rtc-room
                class="rtcroom"
                id="test"
                userId={uid}
                roomId={roomId}
                token={token}
                signature={signature}
                autoplay
                enable-camera
                fps={30}
                resolution={2}
                record={false}
                min-bitrate=""
                max-bitrate=""
                extraInfo={{
                  isAliPay: true
                }}
                onRoomInfo={(e) => {
                  console.log(e, '111111 roominfo test')
                }}
                onEnterRoom={(e) => {
                  console.log(e, '111111 enterroom')
                }}
                onError={(e) => {
                  console.log(e, '111111 enterroom')
                }}
                onFirstRender={(e) => {
                  console.log(e, '111111 enterroom')
                }}
                // // TODO 错误处理
                // onError="onError"
                // onEnterRoom = "onEnterRoom"
              />
    

    原生组件代码:

    <rtc-room
    class="rtcroom"
    id="myRtcroom"
    roomId="{{roomId}}"
    token="{{token}}"
    userId="{{userId}}"
    signature="{{signature}}"
    autoplay="{{rtcroom.autoplay}}"
    enable-camera="{{rtcroom.enableCamera}}"
    fps="{{rtcroom.fps}}"
    resolution="{{rtcroom.resolution}}"
    record="{{rtcroom.record}}"
    min-bitrate="{{rtcroom.minBitrate}}"
    max-bitrate="{{rtcroom.maxBitrate}}"
    extraInfo="{{rtcroom.extraInfo}}"
    onError="onError"
    onRoomInfo="onRoomInfo"
    onEnterRoom = "onEnterRoom"
    onParticipantEnter = "onParticipantEnter"
    onParticipantLeave = "onParticipantLeave"
    onAudioPlayoutMode = "onAudioPlayoutMode"
    onNetworkType = "onNetworkType"
    onNetWorkQuality = "onNetWorkQuality"
    onReceiveRecordId = "onReceiveRecordId"
    onFirstRender = "onFirstRender"
    onRenderStop = "onRenderStop"
    />


登录后回复