I am building a permissions UI, I have a list of permissions with a select list next to each permission. The permissions are represented by an observable array of objects which
Create js component
define([
'Magento_Ui/js/form/element/select',
'mage/translate'
], function (AbstractField, $t) {
'use strict';
return AbstractField.extend({
defaults: {
imports: {
update: 'checkout.steps.shipping-step.shippingAddress.shipping-address-fieldset.country_id:value'
},
modules: {
vat_id: '${ $.parentName }.vat_id'
}
},
/**
* Initializes UISelect component.
*
* @returns {UISelect} Chainable.
*/
initialize: function () {
this._super();
this.vat_id().visible(false);
return this;
},
update: function (value) {
if(value == 'GB'){
this.vat_id().visible(true);
}else{
this.vat_id().visible(false);
}
}
});
});