javascript-预期为“ ID”,获得了“ NUMBER”
作者:互联网
我在json中有以下数据
"ICON":{
"144":"https://example.com/bubble-academy.jpg",
"228":"https://example.com/bubble-academy.jpg",
"72":"https://example.com/bubble-academy.jpg",
"152":"https://example.com/bubble-academy.jpg",
"130":"https://example.com/bubble-academy.jpg",
"120":"https://example.com/bubble-academy.jpg",
"32":"https://example.com/bubble-academy.jpg"
}
在车把中,我试图像下面那样访问属性32.
<img src="{{ ICON.32 }}">
我得到以下错误
Module build failed: Error: Parse error on line 5:
..."{{ mediaFiles.ICON.32 }}"> <sp
-----------------------^
Expecting 'ID', got 'NUMBER'
我怎么解决这个问题?
解决方法:
这是因为您使用数字作为属性名称,请尝试使用以下名称:
< img src =“ {{ICON.[32]}}”>
标签:handlebars-js,javascript 来源: https://codeday.me/bug/20191111/2022887.html