附上源码
const toggleSwitch = new ToggleComponent(itemEl.controlEl)
toggleSwitch.setTooltip(t('管理器_切换状态_描述'))
toggleSwitch.setValue(ManagerPlugin.enabled)
toggleSwitch.onChange(async () => {
if (toggleSwitch.getValue()) {
if (this.settings.FADE_OUT_DISABLED_PLUGINS) itemEl.settingEl.removeClass('inactive'); // [淡化插件]
ManagerPlugin.enabled = true;
this.manager.saveSettings();
// await this.appPlugins.enablePlugin(plugin.id);
await this.appPlugins.enablePluginAndSave(plugin.id);
} else {
if (this.settings.FADE_OUT_DISABLED_PLUGINS) itemEl.settingEl.addClass('inactive'); // [淡化插件]
ManagerPlugin.enabled = false;
this.manager.saveSettings();
// await this.appPlugins.disablePlugin(plugin.id);
await this.appPlugins.disablePluginAndSave(plugin.id);
}
this.reloadShowData();
})