Глобальный рефакторинг SettingsPage (в процессе)
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
<div class="item row">
|
|
||||||
<q-btn class="col q-ma-sm" dense no-caps @click="setDefaults">Установить по умолчанию</q-btn>
|
|
||||||
</div>
|
|
||||||
41
client/components/Reader/SettingsPage/ResetTab/ResetTab.vue
Normal file
41
client/components/Reader/SettingsPage/ResetTab/ResetTab.vue
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<template>
|
||||||
|
<div class="fit sets-tab-panel">
|
||||||
|
<div class="sets-item row">
|
||||||
|
<q-btn class="col q-ma-sm" dense no-caps @click="setDefaults">
|
||||||
|
Установить по умолчанию
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
import vueComponent from '../../../vueComponent.js';
|
||||||
|
|
||||||
|
const componentOptions = {
|
||||||
|
components: {
|
||||||
|
},
|
||||||
|
};
|
||||||
|
class ResetTab {
|
||||||
|
_options = componentOptions;
|
||||||
|
_props = {
|
||||||
|
form: Object,
|
||||||
|
};
|
||||||
|
|
||||||
|
created() {
|
||||||
|
}
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
}
|
||||||
|
|
||||||
|
setDefaults() {
|
||||||
|
this.$emit('tab-event', {action: 'set-defaults'});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default vueComponent(ResetTab);
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
@@ -94,10 +94,8 @@
|
|||||||
<UpdateTab v-if="selectedTab == 'update'" :form="form" />
|
<UpdateTab v-if="selectedTab == 'update'" :form="form" />
|
||||||
<!-- Прочее ---------------------------------------------------------------------->
|
<!-- Прочее ---------------------------------------------------------------------->
|
||||||
<OthersTab v-if="selectedTab == 'others'" :form="form" />
|
<OthersTab v-if="selectedTab == 'others'" :form="form" />
|
||||||
<!-- Сброс ----------------------------------------------------------------------->
|
<!-- Сброс ----------------------------------------------------------------------->
|
||||||
<!--div v-if="selectedTab == 'reset'" class="fit tab-panel">
|
<ResetTab v-if="selectedTab == 'reset'" :form="form" @tab-event="tabEvent" />
|
||||||
@@include('./ResetTab.inc');
|
|
||||||
</div-->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Window>
|
</Window>
|
||||||
@@ -127,6 +125,7 @@ import PageMoveTab from './PageMoveTab/PageMoveTab.vue';
|
|||||||
import ConvertTab from './ConvertTab/ConvertTab.vue';
|
import ConvertTab from './ConvertTab/ConvertTab.vue';
|
||||||
import UpdateTab from './UpdateTab/UpdateTab.vue';
|
import UpdateTab from './UpdateTab/UpdateTab.vue';
|
||||||
import OthersTab from './OthersTab/OthersTab.vue';
|
import OthersTab from './OthersTab/OthersTab.vue';
|
||||||
|
import ResetTab from './ResetTab/ResetTab.vue';
|
||||||
|
|
||||||
const hex = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/;
|
const hex = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/;
|
||||||
|
|
||||||
@@ -141,6 +140,7 @@ const componentOptions = {
|
|||||||
ConvertTab,
|
ConvertTab,
|
||||||
UpdateTab,
|
UpdateTab,
|
||||||
OthersTab,
|
OthersTab,
|
||||||
|
ResetTab,
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
settings: function() {
|
settings: function() {
|
||||||
@@ -390,16 +390,22 @@ class SettingsPage {
|
|||||||
async setDefaults() {
|
async setDefaults() {
|
||||||
try {
|
try {
|
||||||
if (await this.$root.stdDialog.confirm('Подтвердите установку настроек по умолчанию:', ' ')) {
|
if (await this.$root.stdDialog.confirm('Подтвердите установку настроек по умолчанию:', ' ')) {
|
||||||
this.form = Object.assign({}, rstore.settingDefaults);
|
this.form = _.cloneDeep(rstore.settingDefaults);
|
||||||
for (let prop in rstore.settingDefaults) {
|
|
||||||
this[prop] = this.form[prop];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tabEvent(event) {
|
||||||
|
if (!event || !event.action)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (event.action) {
|
||||||
|
case 'set-defaults': this.setDefaults(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
loadWallpaperFileClick() {
|
loadWallpaperFileClick() {
|
||||||
this.$refs.file.click();
|
this.$refs.file.click();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user