ReactJs Antd - window.open 一个 url 动态
ReactJs Antd - window.open an url dynamically
我正在使用以下代码在弹出窗口 window 上打开 url。
{
title: 'Contract',
dataIndex: 'index',
key: 'contract',
render: (text,record,index) =>
<button onClick={() => window.open({record.contract}, "Popup","width=600, height=600")}>
Open
</button>
},
问题是我无法调用对象值 {record.contract}
。
它抛出 Unexpected token, expected ","
错误。
有人可以帮忙吗?
当您的编程语法不正确时,通常会发生意外的令牌错误。
{record.contract}
语法无效。
在事件中传递给方法时,应该直接使用变量名。
按钮的正确语法是:
<button onClick={() => window.open(record.contract, "Popup","width=600, height=600")}>
Open
</button>
这将解决意外令牌错误。
我正在使用以下代码在弹出窗口 window 上打开 url。
{
title: 'Contract',
dataIndex: 'index',
key: 'contract',
render: (text,record,index) =>
<button onClick={() => window.open({record.contract}, "Popup","width=600, height=600")}>
Open
</button>
},
问题是我无法调用对象值 {record.contract}
。
它抛出 Unexpected token, expected ","
错误。
有人可以帮忙吗?
当您的编程语法不正确时,通常会发生意外的令牌错误。
{record.contract}
语法无效。
在事件中传递给方法时,应该直接使用变量名。 按钮的正确语法是:
<button onClick={() => window.open(record.contract, "Popup","width=600, height=600")}>
Open
</button>
这将解决意外令牌错误。