修改 toggle event

This commit is contained in:
fofolee 2022-05-09 00:35:02 +08:00
parent 69f72b1098
commit 30bcfadc59

View File

@ -41,7 +41,9 @@
> >
<template v-slot:append> <template v-slot:append>
<q-toggle <q-toggle
@click="toggleFeature('favFile')" @update:model-value="
(val, e) => toggleFeature('favFile', val)
"
v-model="$root.profile.quickFileEnable" v-model="$root.profile.quickFileEnable"
checked-icon="check" checked-icon="check"
color="primary" color="primary"
@ -70,7 +72,9 @@
> >
<template v-slot:append> <template v-slot:append>
<q-toggle <q-toggle
@click="toggleFeature('favUrl')" @update:model-value="
(val, e) => toggleFeature('favUrl', val)
"
v-model="$root.profile.quickUrlEnable" v-model="$root.profile.quickUrlEnable"
checked-icon="check" checked-icon="check"
color="primary" color="primary"
@ -100,7 +104,9 @@
> >
<template v-slot:append> <template v-slot:append>
<q-toggle <q-toggle
@click="toggleFeature('pluNickName')" @update:model-value="
(val, e) => toggleFeature('pluNickName', val)
"
v-model="$root.profile.pluNickNameEnable" v-model="$root.profile.pluNickNameEnable"
checked-icon="check" checked-icon="check"
color="primary" color="primary"
@ -474,13 +480,10 @@ export default {
quickcommand.showMessageBox("取消收藏成功"); quickcommand.showMessageBox("取消收藏成功");
}, },
// //
toggleFeature(type) { toggleFeature(type, enable) {
this.$root.utools.whole.removeFeature(this.features[type].code) || enable
this.$root.utools.whole.setFeature(_.cloneDeep(this.features[type])); ? this.$root.utools.whole.setFeature(_.cloneDeep(this.features[type]))
if (type === "apiServer" && !this.$root.profile.apiServerEnable) { : this.$root.utools.whole.removeFeature(this.features[type].code);
window.quickcommandHttpServer().stop();
this.$root.nativeProfile.serverStatus = false;
}
}, },
}, },
}; };