我有一個(gè) Json 文件["Cooling": { "id": 1, "title": "Cooling", "description": "Lorem Ipsum is simply ${dummy} text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took" }]我想在渲染之前根據(jù)某些條件將 ${dummy} 替換為其他內(nèi)容。這在反應(yīng)中可能嗎?我在我的 react App.js 組件中導(dǎo)入這個(gè)文件并將其顯示為:return ( <div> <div className="row"> {Json.map(item => ( <div className="col-md-1"> <hr /> <p key={item.id}> {item.title} </p> <p>{item.description}</p> </div> ))} </div> </div> );這里可以在渲染之前替換 item.description 中的 ${dummy} 嗎?
用來(lái)自 JSON 的字符串中的變量值替換 ${dummy}
哆啦的時(shí)光機(jī)
2021-06-14 10:13:59