我从服务中获取数据,其中对象的阵列来象下面这样: -手柄栏中的访问对象属性包含'。'
[{
title : 'Tilte 1',
s.no : 1
},
{
title : 'Tilte 2',
s.no : 2
}
]
我已经使用车把模板解析像下面这样的数据: -
{{#each this}}
<div>
<span>{{this.s.no}}</span>
<h2>{{this.title}}</h2>
</div>
{{/each}}
在上述我我无法访问该属性('s.no')。在香草JavaScript中,我们可以像这样访问['s.no'],但是在手柄中它不起作用。
{{this。[s.no]}}或{{this。[“s.no”]}}试试这两个。 –