补充完整后的代码如下:
var statusMap = {
'1': '选项1',
'2': '选项2'
};
self.phoneType = new SmallSelectItem({
title: '',
type: 'primary'
}).setWidth('150px').setHeight('40px').setCssProperty("margin", "10px 5px 10px 5px").setPlaceholder('请选择类型').setValuesMap(statusMap);
self.softPhonePanel = new SoftPhonePanel();
self.MakephoneCall = new MakephoneCall();
const SHOW_LOGO_MODES = ['MANAGER'];
if (SHOW_LOGO_MODES.includes(window.currentModeCode)) {
let phoneTypeTab = new Tab({
id: "phoneType",
title: '',
closable: false
}).addClass('top-softbar');
phoneTypeTab.setContent(self.phoneType);
self.tabset.addTab(phoneTypeTab);
let softPhoneTab = new Tab({
id: "softPhone",
title: '',
closable: false
}).addClass('top-softbar');
softPhoneTab.setContent(self.softPhonePanel);
self.tabset.addTab(softPhoneTab);
self.softPhonePanel.show();
self.MakephoneCall.hide();
let makePhoneTab = new Tab({
id: 'makePhone',
title: '',
closable: false
}).addClass('tab-item');
makePhoneTab.setContent(self.MakephoneCall);
self.tabset.addTab(makePhoneTab);
self.MakephoneCall.hide();
self.phoneType.addChangeHandler(function() {
let selectedValue = self.phoneType.getValue();
if (selectedValue === '1') {
softPhoneTab.setContent(self.softPhonePanel);
self.softPhonePanel.show();
self.MakephoneCall.hide();
makePhoneTab.hide();
console.log(makePhoneTab.id);
// self.tabset.removeTab(makePhoneTab.id);
} else if (selectedValue === '2') {
makePhoneTab.setContent(self.MakephoneCall);
self.MakephoneCall.show();
self.softPhonePanel.hide();
makePhoneTab.show();
console.log(softPhoneTab.id);
// self.tabset.removeTab(softPhoneTab.id);
}
});
}
这是一个补充完整的代码片段,包括 statusMap
对象的定义和 self.SoftPhonePanel
、self.MakephoneCall
的创建。在此基础上,根据下拉框选择来切换展示内容。
内容由零声教学AI助手提供,问题来源于学员提问