我有一个对象定义为:
{ “ IP地址”:“ 1.1.1.1”, “名称”:“ User1” }
以HTML
{{data.IP地址}}
它显示错误The righthand side of arithmetic operator must be type 'any'
。
由于连字符(-)。
我该如何解决?
答案 0 :(得分:2)
尝试
{{data?.ipAddress}}
但是我也建议管理更简单的属性名称,以便您可以使用safe navigation operator,以防它对您的应用有用。
所以您可以这样做
TypeError: Cannot read property 'name' of null.
并防止可能的错误
In [1]: import pandas as pd
In [2]: delta = pd.Timedelta('10000000000000000 ns')
In [3]: delta / pd.Timedelta('365 days')
Out[3]: 0.31709791983764585
如果对象仍为null或未定义时正在渲染。
答案 1 :(得分:0)
将您的html代码更改为{{data['IP-Address']}}