[英]Have there been any efforts to port some of Rails' View Helpers to Javascript?
It would be great to have helpers like linkTo()
, truncate()
, and pluralize()
in Javascript. 在Javascript中拥有诸如
linkTo()
, truncate()
和pluralize()
类的助手将是很棒的。 Have there been any efforts to port some or all of Rails' view helpers to Javascript? 是否有任何努力将Rails的部分或全部视图助手移植到Javascript?
If you just need one or two, you can find snippets for pluralize and singularize or another for truncating . 如果只需要一个或两个,则可以找到用于复数和单数化的代码片段,或用于截断的另一个代码 片段 。
And actually, there's now a javascript library that handles a lot of the syntactic sugar: 实际上,现在有了一个处理许多语法糖的javascript库:
Like I said in my original post, no need to include a whole library if you only want one or two of them or can manage to just use the Rails helpers, but the option to have them is out there. 就像我在原始帖子中所说的那样,如果您只需要其中一个或两个,或者可以仅使用Rails助手,则无需包括整个库,但是可以选择使用它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.