在LWC Salesforce中在window.open中发送JSON对象数据

问题描述 投票:0回答:1

我试图在Window.Open中发送下面的JSON对象,但是当我尝试检索它时,却得到了

“ [对象对象]”

@track InputValues = {
    strName: "test",
    strAddress: "test",
    strCountry: "test",
    strCode: "1",
    strNumber: "1"
  };



 window.open("/c/testApp.app?recordId="+this.recordId +"&getallinputs="+this.InputValues,'_blank');

Aura testApp

<aura:application extends="force:slds" access="GLOBAL" implements="force:appHostable,force:hasRecordId">
    <aura:attribute name="recordId" type="String" default="123"/>
     <aura:attribute name="getallinputs" type="String"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <c:test recordId="{!v.recordId}" jsonDetails="{!v.getallinputs}"/>
</aura:application>

在接收LWC结束时-

renderedCallback() {
    this.dataJson = JSON.stringify(this.InputValues);
  }
javascript json salesforce-lightning
1个回答
0
投票

您需要在obj周围应用JSON.stringify()才能查看它。

let inputVal = JSON.stringify(this.InputValues);    
window.open("/c/testApp.app?recordId="+this.recordId +"&getallinputs="+inputVal ,'_blank');
© www.soinside.com 2019 - 2024. All rights reserved.