Oro JavaScript 模块化不起作用
Oro JavaScript Modularity is not working
遗憾的是,我的 oro 自定义 javascript 组件未加载
我的reuiqrejs.yml在这里
Company/Bundle/BarcodeBundle/Resources/config/requirejs.yml
config:
paths:
'companybarcode/js/app/components/custom-component': 'bundles/companybarcode/js/app/components/custom-component.js'
Company/Bundle/BarcodeBundle/Resources/public/js/app/components/custom-component.js
我的习惯-component.js如下
define(function (require) {
'use strict';
var CustomComponent = BaseComponent.extend({
initialize: function (options) {
alert("Hello Component");
}
})
return CustomComponent;
});
我对加载组件的看法是
Company/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;
});
遗憾的是,我的 oro 自定义 javascript 组件未加载
我的reuiqrejs.yml在这里
Company/Bundle/BarcodeBundle/Resources/config/requirejs.yml
config:
paths:
'companybarcode/js/app/components/custom-component': 'bundles/companybarcode/js/app/components/custom-component.js'
Company/Bundle/BarcodeBundle/Resources/public/js/app/components/custom-component.js
我的习惯-component.js如下
define(function (require) {
'use strict';
var CustomComponent = BaseComponent.extend({
initialize: function (options) {
alert("Hello Component");
}
})
return CustomComponent;
});
我对加载组件的看法是
Company/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;
});