简体   繁体   English

Jade模板 - 升级到pug后不会在大括号中处理json?

[英]Jade template - does not process json in curly bracket after upgrading to pug?

Why jade does not process json properly anymore after upgrading to pug? 为什么玉升级到帕格后不再正常处理json?

For instance: 例如:

a.btn.btn-link(href="/datasets/#{dataset.index}") Show

Result: 结果:

<a class="btn btn-link" href="/datasets/#{dataset.index}">Show</a>

It should be: 它应该是:

<a class="btn btn-link" href="/datasets/ISIUSXSXX">Show</a>

Any ideas why? 有什么想法吗?

EDIT: 编辑:

I think this is it: 我觉得这就是:

a(href=`before${link}after`)

I seriously don't understand why a developer would choose pug/jade - the 'code' looks utterly ugly and unreadable! 我真的不明白为什么开发人员会选择帕格/玉 - “代码”看起来非常丑陋且难以理解! Syntaxes are confusing. 语法令人困惑。 Rules are not consistent! 规则不一致! Just a rant! 只是一个咆哮!

The syntax has changed to use ES6 template strings: 语法已更改为使用ES6模板字符串:

a.btn.btn-link(href="/datasets/#{dataset.index}")

becomes: 变为:

a.btn.btn-link(href=`/datasets/${dataset.index}`)

Reference issue 参考问题

We removed support for interpolation in attributes since it was unnecessarily complex in implementation and tended to delay users learning that they can just use any JavaScript value in place of attributes 我们删除了对属性插值的支持,因为它在实现中不必要地复杂,并且倾向于延迟用户学习他们可以使用任何JavaScript值代替属性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM