10

Grails 3.0.0 M1 声明 g:remoteLink 已被弃用,在 3.0.1 中它不再存在于 g: 命名空间中。文档中没有任何内容建议替换此功能。有人会回复 GSP 文件的替换选项以使用 Prototype JavaScript 库执行控制器操作吗?如果可能的话,是否会提供一种利用 Groovy 自定义标签库来直接消除 GSP 文件中的嵌入代码的解决方案?

4

1 回答 1

16

The tags use inline javascript embedded into HTML tags which has long been considered bad practise. At the same time the APIs for creating remote links with JavaScript frameworks like jQuery and so on have advanced to the point where it is just as easy to use them and they have the advantage that the static resources can be optimised by asset pipeline and your application will perform better.

So given how things have changed over the last few years the Grails team decided to deprecate the tags as they are no longer considered best practise and you are better off using the native JavaScript APIs (jQuery etc.) as an alternative.

The original tags are still available at https://bintray.com/grails/plugins/ajax-tags

If you want them you have to declare a dependency:

compile 'org.grails.plugins:ajax-tags:1.0.0.RC1'
于 2015-06-15T10:28:35.273 回答