反应-冒号被替换

时间:2018-08-22 12:21:35

标签: reactjs url

谁能解释一下,为什么在这种情况下要更换结肠?

<div className="col-6 text-left">
{
    hasHomepage && 
    <a href={'http://' + this.props.productGroup.supplierWebsite} target="_blank">
        {this.props.productGroup.supplierName}
    </a>
}
{
    !hasHomepage &&
    this.props.productGroup.supplierName
}
</div> 

渲染时的结果是:

enter image description here

这是已知问题还是我想念什么?

1 个答案:

答案 0 :(得分:3)

您所看到的是function Foo(param){ return new Promise(function(resolve, reject) { resolve(param); }); } function Bar(param){ return new Promise(function(resolve, reject) { resolve(param); }); } function fooBar (param){ return new Promise(function(resolve, reject) { resolve(param); }); } async function fooTheBar(a) { const b = await Foo(a); const c = await Bar(b); const d = await fooBar(c); return {foooo: d}; } fooTheBar("foo").then((resp)=>{ console.log(resp)})的内容,您添加http://的位置将不会显示在浏览器内容中