收藏
回答

小程序分享朋友圈传参数,开发工具测试没问题,但是从手机朋友圈打开,参数为undefined,为啥呢?

useShareTimeline(() => {

const agentId = currentRobotInfo?.agentId;

const agentName = currentRobotInfo?.agentName;

const chatNum = currentRobotInfo?.chatNum;

const introduce = currentRobotInfo?.introduce;

const query = "agentId=" + agentId + "&agentName=" + agentName + "&chatNum=" + chatNum + "&introduce=" + introduce;

return {

query: query,

title: "12312344",

//title: `${shareAiImg?.wechatMomentsTitle || "众瓜!11"}`,

imageUrl: currentRobotInfo?.icon

}

})



useLoad((options) => {

console.log("1111111111111111111111111111111111111111111111111111111111111111111params:", options

const launchOptions = Taro.getLaunchOptionsSync();

const scene = launchOptions.scene;

if (scene === 1154) {

setChatNum(options.chatNum || 1);

setAgentName(options.agentName);

setIntroduce(options.introduce);

setIsSharePage(true);

} else {

setIsSharePage(false);

}

});


<View className="chat-share-page">

<Image className="chat-share-bg" src={chatShare} />

<View className='chat-count'>

<View className='number'>{chatNum}</View>

<View className='text'>人聊过</View>

</View>

<View className='agent-name'>

{console.log('agentName值:', agentName)}

{agentName}

</View>

<View className='introduction'>{introduce}</View>

<View className='share-card-footer'>

<View className="text-block">

</View>

</View>

</View>

回答关注问题邀请回答
收藏

2 个回答

登录 后发表内容