2017-05-30 88 views

回答

1

您可以在自定義塊模板/組件內使用Magento_Checkout/js/view/progress-bar組件或Magento_Checkout/js/model/step-navigator組件(由progress-bar使用)。

使用進度條:

var registry = require('uiRegistry'), 
    progressBar = registry.get('index = progressBar'), 
    firstStep = progressBar.steps()[0]; 

progressBar.isProcessed(firstStep); // returns bool, shipping step by default 

result

使用步驟導航器:

var stepnav = require('Magento_Checkout/js/model/step-navigator'); 
stepnav.getActiveItemIndex() // returns int - 0 for shipping & 1 for payment by default 

或:

var registry = require('Magento_Checkout/js/model/step-navigator'); 
registry.isProcessed('shipping'); // returns bool, you are on shipping step 

注意:所述第二步驟的名字是支付默認

PS:自己的組件裏面你可以添加Magento_Checkout/js/view/progress-barMagento_Checkout/js/model/step-navigator的定義列表:

define(
    [ 
     'Magento_Checkout/js/model/step-navigator' 
    ], 
    function (
     stepNavigator 
    ) { 
     // do something with stepNavigator 
    } 
); 
相關問題