diff --git a/src/components/midjourney/FinalPrompt.vue b/src/components/midjourney/FinalPrompt.vue index 1beae60..9e50cd8 100644 --- a/src/components/midjourney/FinalPrompt.vue +++ b/src/components/midjourney/FinalPrompt.vue @@ -1,7 +1,7 @@ @@ -27,7 +27,7 @@ export default defineComponent({ diff --git a/src/components/midjourney/preset/AdvancedSelector.vue b/src/components/midjourney/preset/AdvancedSelector.vue index 1846d21..d52bb3a 100644 --- a/src/components/midjourney/preset/AdvancedSelector.vue +++ b/src/components/midjourney/preset/AdvancedSelector.vue @@ -8,7 +8,6 @@ @@ -56,7 +46,7 @@ export default defineComponent({ .title { font-size: 14px; - margin-bottom: 0; + margin: 0; width: 30%; } .value { diff --git a/src/components/midjourney/preset/ChaosSelector.vue b/src/components/midjourney/preset/ChaosSelector.vue index 6740889..33ecdee 100644 --- a/src/components/midjourney/preset/ChaosSelector.vue +++ b/src/components/midjourney/preset/ChaosSelector.vue @@ -19,33 +19,24 @@ export default defineComponent({ ElSlider, InfoIcon }, - props: { - modelValue: { - type: String, - default: undefined - } - }, - emits: ['update:modelValue'], - data() { - return { - value: this.modelValue - }; - }, - watch: { - modelValue(val) { - if (val !== this.value) { - this.value = val; + computed: { + value: { + get() { + return this.$store.state.midjourney.preset?.chaos; + }, + set(val) { + console.debug('set quality', val); + this.$store.commit('midjourney/setPreset', { + ...this.$store.state.midjourney.preset, + chaos: val + }); } - }, - value(val) { - this.$emit('update:modelValue', val); } }, mounted() { if (!this.value) { this.value = DEFAULT_CHAOS; } - this.$emit('update:modelValue', this.value); } }); @@ -58,7 +49,7 @@ export default defineComponent({ .title { font-size: 14px; - margin-bottom: 0; + margin: 0; width: 30%; } .value { diff --git a/src/components/midjourney/preset/ImageWeightSelector.vue b/src/components/midjourney/preset/ImageWeightSelector.vue index 8bffca5..83b003e 100644 --- a/src/components/midjourney/preset/ImageWeightSelector.vue +++ b/src/components/midjourney/preset/ImageWeightSelector.vue @@ -19,33 +19,24 @@ export default defineComponent({ ElSlider, InfoIcon }, - props: { - modelValue: { - type: String, - default: undefined - } - }, - emits: ['update:modelValue'], - data() { - return { - value: this.modelValue - }; - }, - watch: { - modelValue(val) { - if (val !== this.value) { - this.value = val; + computed: { + value: { + get() { + return this.$store.state.midjourney.preset?.iw; + }, + set(val) { + console.debug('set iw', val); + this.$store.commit('midjourney/setPreset', { + ...this.$store.state.midjourney.preset, + iw: val + }); } - }, - value(val) { - this.$emit('update:modelValue', val); } }, mounted() { if (!this.value) { this.value = DEFAULT_IW; } - this.$emit('update:modelValue', this.value); } }); @@ -58,7 +49,7 @@ export default defineComponent({ .title { font-size: 14px; - margin-bottom: 0; + margin: 0; width: 30%; } .value { diff --git a/src/components/midjourney/preset/ModelSelector.vue b/src/components/midjourney/preset/ModelSelector.vue index 832e264..eb52090 100644 --- a/src/components/midjourney/preset/ModelSelector.vue +++ b/src/components/midjourney/preset/ModelSelector.vue @@ -6,10 +6,7 @@ v-for="(option, optionKey) in options" :key="optionKey" :class="{ active: active === optionKey, item: true }" - @click=" - active = optionKey; - value = option.value; - " + @click="value = option.value" >

@@ -23,22 +20,14 @@ diff --git a/src/components/midjourney/preset/NijiSelector.vue b/src/components/midjourney/preset/NijiSelector.vue deleted file mode 100644 index 420e1c3..0000000 --- a/src/components/midjourney/preset/NijiSelector.vue +++ /dev/null @@ -1,68 +0,0 @@ - - - - - diff --git a/src/components/midjourney/preset/QualitySelector.vue b/src/components/midjourney/preset/QualitySelector.vue index 3777ae0..946e99a 100644 --- a/src/components/midjourney/preset/QualitySelector.vue +++ b/src/components/midjourney/preset/QualitySelector.vue @@ -21,17 +21,8 @@ export default defineComponent({ ElRadioButton, ElRadioGroup }, - props: { - modelValue: { - type: String, - default: undefined - } - }, - emits: ['update:modelValue'], data() { return { - value: this.modelValue, - active: 0, options: [ { label: '低', @@ -48,21 +39,24 @@ export default defineComponent({ ] }; }, - watch: { - modelValue(val) { - if (val !== this.value) { - this.value = val; + computed: { + value: { + get() { + return this.$store.state.midjourney.preset?.quality; + }, + set(val) { + console.debug('set quality', val); + this.$store.commit('midjourney/setPreset', { + ...this.$store.state.midjourney.preset, + quality: val + }); } - }, - value(val) { - this.$emit('update:modelValue', val); } }, mounted() { if (!this.value) { this.value = DEFAULT_QUALITY; } - this.$emit('update:modelValue', this.value); } }); @@ -75,7 +69,7 @@ export default defineComponent({ .title { font-size: 14px; - margin-bottom: 0; + margin: 0; width: 30%; } .value { diff --git a/src/components/midjourney/preset/RatioSelector.vue b/src/components/midjourney/preset/RatioSelector.vue index 48556d0..a7e5ca0 100644 --- a/src/components/midjourney/preset/RatioSelector.vue +++ b/src/components/midjourney/preset/RatioSelector.vue @@ -6,10 +6,7 @@ v-for="(option, optionKey) in options" :key="optionKey" :class="{ active: active === optionKey, item: true }" - @click=" - active = optionKey; - value = option.value; - " + @click="value = option.value" >

@@ -29,16 +26,8 @@ const DEFAULT_RATIO = '1:1'; export default defineComponent({ name: 'RatioSelector', - props: { - modelValue: { - type: String, - default: undefined - } - }, - emits: ['update:modelValue'], data() { return { - value: this.modelValue, options: [ { value: '1:1', @@ -75,26 +64,25 @@ export default defineComponent({ }, computed: { active() { - return this.options.findIndex((option) => option.value === this.value); - } - }, - watch: { - modelValue(val) { - if (val !== this.value) { - this.value = val; - } + return this.options.findIndex((option) => option.value === this.value) || 0; }, - value(val) { - this.$emit('update:modelValue', val); + value: { + get() { + return this.$store.state.midjourney.preset?.ratio; + }, + set(val) { + console.debug('set ratio', val); + this.$store.commit('midjourney/setPreset', { + ...this.$store.state.midjourney.preset, + ratio: val + }); + } } }, mounted() { - if (!this.modelValue) { + if (!this.value) { this.value = DEFAULT_RATIO; - } else { - this.value = this.modelValue; } - this.$emit('update:modelValue', this.value); } }); diff --git a/src/components/midjourney/preset/RawSelector.vue b/src/components/midjourney/preset/RawSelector.vue deleted file mode 100644 index e0d5ad3..0000000 --- a/src/components/midjourney/preset/RawSelector.vue +++ /dev/null @@ -1,68 +0,0 @@ - - - - - diff --git a/src/components/midjourney/preset/StyleSelector.vue b/src/components/midjourney/preset/StyleSelector.vue new file mode 100644 index 0000000..53c629d --- /dev/null +++ b/src/components/midjourney/preset/StyleSelector.vue @@ -0,0 +1,103 @@ + + + + + diff --git a/src/components/midjourney/preset/StylizeSelector.vue b/src/components/midjourney/preset/StylizeSelector.vue index 8ef6d64..5d17749 100644 --- a/src/components/midjourney/preset/StylizeSelector.vue +++ b/src/components/midjourney/preset/StylizeSelector.vue @@ -19,33 +19,24 @@ export default defineComponent({ ElSlider, InfoIcon }, - props: { - modelValue: { - type: String, - default: undefined - } - }, - emits: ['update:modelValue'], - data() { - return { - value: this.modelValue - }; - }, - watch: { - modelValue(val) { - if (val !== this.value) { - this.value = val; + computed: { + value: { + get() { + return this.$store.state.midjourney.preset?.stylize; + }, + set(val) { + console.debug('set stylize', val); + this.$store.commit('midjourney/setPreset', { + ...this.$store.state.midjourney.preset, + stylize: val + }); } - }, - value(val) { - this.$emit('update:modelValue', val); } }, mounted() { if (!this.value) { this.value = DEFAULT_STYLIZE; } - this.$emit('update:modelValue', this.value); } }); @@ -58,7 +49,7 @@ export default defineComponent({ .title { font-size: 14px; - margin-bottom: 0; + margin: 0; width: 30%; } .value { diff --git a/src/components/midjourney/preset/TranslationSelector.vue b/src/components/midjourney/preset/TranslationSelector.vue index 6f64e06..d356eb5 100644 --- a/src/components/midjourney/preset/TranslationSelector.vue +++ b/src/components/midjourney/preset/TranslationSelector.vue @@ -19,33 +19,24 @@ export default defineComponent({ ElSwitch, InfoIcon }, - props: { - modelValue: { - type: Boolean, - default: DEFAULT_TRANSLATION - } - }, - emits: ['update:modelValue'], - data() { - return { - value: this.modelValue - }; - }, - watch: { - modelValue(val) { - if (val !== this.value) { - this.value = val; + computed: { + value: { + get() { + return this.$store.state.midjourney.preset?.translation; + }, + set(val) { + console.debug('set translation', val); + this.$store.commit('midjourney/setPreset', { + ...this.$store.state.midjourney.preset, + translation: val + }); } - }, - value(val) { - this.$emit('update:modelValue', val); } }, mounted() { if (this.value === undefined) { this.value = DEFAULT_TRANSLATION; } - this.$emit('update:modelValue', this.value); } }); @@ -58,7 +49,7 @@ export default defineComponent({ .title { font-size: 14px; - margin-bottom: 0; + margin: 0; width: 30%; } .value { diff --git a/src/components/midjourney/preset/VersionSelector.vue b/src/components/midjourney/preset/VersionSelector.vue index 3699f56..2aa546f 100644 --- a/src/components/midjourney/preset/VersionSelector.vue +++ b/src/components/midjourney/preset/VersionSelector.vue @@ -1,7 +1,7 @@