为了账号安全,请及时绑定邮箱和手机立即绑定

用来自 JSON 的字符串中的变量值替换 ${dummy}

用来自 JSON 的字符串中的变量值替换 ${dummy}

哆啦的时光机 2021-06-14 10:13:59
我有一个 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"  }]我想在渲染之前根据某些条件将 ${dummy} 替换为其他内容。这在反应中可能吗?我在我的 react App.js 组件中导入这个文件并将其显示为: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} 吗?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 318 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信