是否可以覆盖方法** CreateLink **和** CreateLinkTo **的行为? [英] Is possible to overwrite the behaviour of the methods **CreateLink** and **CreateLinkTo**?
本文介绍了是否可以覆盖方法** CreateLink **和** CreateLinkTo **的行为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以覆盖方法 CreateLink 和 CreateLinkTo 的行为?
Is possible to overwrite the behaviour of the methods CreateLink and CreateLinkTo?
推荐答案
您可以使用元编程来替换ApplicationTaglib上的闭包。
You could use meta programming to replace the closure on ApplicationTaglib.
ApplicationTagLib.metaClass.getCreateLink = {->
return {attrs->
// your code here
}
}
我从来没有尝试过,但它可能会工作:)
I've never tried it but it might work :)
这篇关于是否可以覆盖方法** CreateLink **和** CreateLinkTo **的行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文