1

我正在开发一个 Mura 插件,它使用 mura 标签来拉入组件并在页面上使用它。基本上我的插件需要调用$.dspObject('component',Arguments.componentid). 由于 mura 范围在插件方法中不可用,所以我猜我需要拉入一个组件 bean,但我不知道该怎么做。

<cffunction name="showPlayer" access="public" output="false" returntype="String">
    <cfargument name="component" type="string" required="true" hint="The ID of the component that contains the playlist." />

    <!--- Create the body content --->
    <cfsavecontent variable="bodycode">
        <cfoutput>#$.dspObject('component',Arguments.component)#</cfoutput>
    </cfsavecontent>
</cffunction>

这是该方法的一个非常精简的版本(完整的 eventHandler 可以在GitHub上找到。

那么我将如何重写我的代码以将组件 bean 拉出(或我需要为它做的任何事情)?

4

1 回答 1

2

有几种可能的方法:

<cfargument name="$">

或者

var $=application.ServiceFactory.getBean(“muraScope”);

或者

var $=getServiceFactory().getBean(“muraScope”);

或者

   var $=getBean(“muraScope”);

请参阅MuraCMS 程序员指南cfobject.cfc

于 2011-04-15T20:41:37.110 回答