从插件访问Mura Component Bean

问题描述

| 我正在开发一个使用mura标签插入组件并在页面上使用它的Mura插件。本质上,我的插件需要调用
$.dspObject(\'component\',Arguments.componentid)
。由于mura范围在plugin方法中不可用,因此我猜测我需要引入一个组件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(或我需要为此做的任何事情)?     

解决方法

有几种可能的方法:
<cfargument name=\"$\">
要么
var $=application.ServiceFactory.getBean(“muraScope”);
要么
var $=getServiceFactory().getBean(“muraScope”);
要么
   var $=getBean(“muraScope”);
请参阅《 MuraCMS程序员指南》和cfobject.cfc     

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...