遗憾的是,我的 oro 自定义 javascript 组件没有加载
我的 reuiqrejs.yml 在这里
公司/Bundle/BarcodeBundle/Resources/config/requirejs.yml
config:
paths:
'companybarcode/js/app/components/custom-component': 'bundles/companybarcode/js/app/components/custom-component.js'
公司/Bundle/BarcodeBundle/Resources/public/js/app/components/custom-component.js
我的 custom-component.js 如下
define(function (require) {
'use strict';
var CustomComponent = BaseComponent.extend({
initialize: function (options) {
alert("Hello Component");
}
})
return CustomComponent;
});
我对加载组件的看法是
公司/Bundle/BarcodeBundle/Resources/views/Barcode/test.html.twig
<div data-page-component-module="companybarcode/js/app/components/custom-component"></div>
我不知道代码有什么问题
黄金参考:https ://oroinc.com/orocrm/doc/2.3/cookbook/how-to-replace-inline-javascript-with-component
在您的代码中,它们缺少部分,为了使用组件,您必须先导入它
define(['path/to/BaseComponent'], function (BaseComponent) {
'use strict';
var CustomComponent = BaseComponent.extend({
initialize: function (options) {
alert("Hello Component");
}
})
return CustomComponent;
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句