Magento2 Magento 2-混入用于混入
如何为已有的Magento2 Magento 2-混入用于混入,magento2,Magento2,如何为已有的mixin构建mixin?有可能吗 我需要覆盖Vendor\u模块:js/checkout mixin中的一个函数,该函数已经是Magento\u checkout:js/something的mixin 我试图在requirejs config.js中设置它,就像我通常在定义mixin时所做的那样,但它不起作用 直接为Magento\u签出设置新的mixin:js/something不是一个选项 谢谢很抱歉,如果您想再次混入已混入的文件,这是可能的 这里是magento自己提供的面包
mixin
构建mixin
?有可能吗
我需要覆盖Vendor\u模块:js/checkout mixin
中的一个函数,该函数已经是Magento\u checkout:js/something的mixin
我试图在requirejs config.js
中设置它,就像我通常在定义mixin时所做的那样,但它不起作用
直接为Magento\u签出设置新的mixin
:js/something
不是一个选项
谢谢很抱歉,如果您想再次混入已混入的文件,这是可能的
这里是magento自己提供的面包屑js的最佳示例
只需将此代码放在您的requirejs-config.js中
var config = {
config: {
mixins: {
'Magento_Catalog/js/product/breadcrumbs': {
'Vendor_ModuleName/js/breadcrumbs-mixin': true
}
}
}
};
并将此代码放入js目录中您自己的供应商公司模块中
define([
'jquery',
'Magento_Catalog/js/product/breadcrumbs',
'jquery/ui'
], function ($) {
'use strict';
return function (widget) {
$.widget('mage.breadcrumbs', widget, {
/**
* {@inheritdoc}
*/
_getCategoryCrumb: function (menuItem) {
//do some custom stuff
return this._super(menuItem);
},
});
return $.mage.breadcrumbs;
};
});
你可以把你的另一种方法
_getCategoryCrumb: function (menuItem) {
//do some custom stuff
return this._super(menuItem);
},
很抱歉,如果您想再次混入已混入的文件,这是可能的
这里是magento自己提供的面包屑js的最佳示例
只需将此代码放在您的requirejs-config.js中
var config = {
config: {
mixins: {
'Magento_Catalog/js/product/breadcrumbs': {
'Vendor_ModuleName/js/breadcrumbs-mixin': true
}
}
}
};
并将此代码放入js目录中您自己的供应商公司模块中
define([
'jquery',
'Magento_Catalog/js/product/breadcrumbs',
'jquery/ui'
], function ($) {
'use strict';
return function (widget) {
$.widget('mage.breadcrumbs', widget, {
/**
* {@inheritdoc}
*/
_getCategoryCrumb: function (menuItem) {
//do some custom stuff
return this._super(menuItem);
},
});
return $.mage.breadcrumbs;
};
});
你可以把你的另一种方法
_getCategoryCrumb: function (menuItem) {
//do some custom stuff
return this._super(menuItem);
},
我也试过,但也失败了。我认为混入混入是不可能的。我也试过,但也失败了。我认为这是不可能的混入一个混入。