admin管理员组文章数量:1432566
I am receiving this error in my vue single file ponent:
Errors piling template:
invalid expression: Unexpected token { in
{{ jobs[0].build_link }}
Raw expression: v-bind:href="{{ jobs[0].build_link }}"
The full line is:
<td :style=tdStyle><a v-bind:href="{{ jobs[0].build_link }}">{{ jobs[0].build_link }}</a></td>
jobs is defined in the data method of my ponent and i can console.log this data without issue.
Also not sure why, but this line works fine with an inline-template vue.js script but throws this error after converting over to a single page ponent.
I am receiving this error in my vue single file ponent:
Errors piling template:
invalid expression: Unexpected token { in
{{ jobs[0].build_link }}
Raw expression: v-bind:href="{{ jobs[0].build_link }}"
The full line is:
<td :style=tdStyle><a v-bind:href="{{ jobs[0].build_link }}">{{ jobs[0].build_link }}</a></td>
jobs is defined in the data method of my ponent and i can console.log this data without issue.
Also not sure why, but this line works fine with an inline-template vue.js script but throws this error after converting over to a single page ponent.
Share Improve this question asked Jun 14, 2019 at 21:08 daviddavid 6,83517 gold badges58 silver badges98 bronze badges 02 Answers
Reset to default 5I think you have a syntax problem. Please try without curly braces. for ex:
<td :style=tdStyle><a v-bind:href="jobs[0].build_link">{{ jobs[0].build_link }}</a></td>
Hope it works..
Removing the curly braces is correct in this case because the v-bind syntax is going to evaluate the expression, but double curly braces will also pre-evaluate it to a string so you end up trying to evaluate a string. So you essentially end up with something like v-bind:href="https://google."
, but "https://google."
is not a variable or expression. Make sense?
本文标签: javascriptWhy am I receiving invalid expression in my vuejs templateStack Overflow
版权声明:本文标题:javascript - Why am I receiving invalid expression in my vue.js template? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745587697a2665009.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论