reset form
This commit is contained in:
parent
3648b08e4b
commit
c00e196be0
@ -46,6 +46,7 @@ function screenshot() {
|
|||||||
<Btn :active="store.formValid" @click="generateLink">Generate link</Btn>
|
<Btn :active="store.formValid" @click="generateLink">Generate link</Btn>
|
||||||
<Btn :active="store.formValid" @click="screenshot">Screenshot</Btn>
|
<Btn :active="store.formValid" @click="screenshot">Screenshot</Btn>
|
||||||
<Btn @click="editModalVisible = true">Edit existing task</Btn>
|
<Btn @click="editModalVisible = true">Edit existing task</Btn>
|
||||||
|
<Btn @click="store.reset">Reset Form</Btn>
|
||||||
<Copyable v-if="link" :contents="link" class="link-view"></Copyable>
|
<Copyable v-if="link" :contents="link" class="link-view"></Copyable>
|
||||||
<EditUrlModal :visible="editModalVisible" @close="editModalVisible = false"
|
<EditUrlModal :visible="editModalVisible" @close="editModalVisible = false"
|
||||||
v-model="existingLink"></EditUrlModal>
|
v-model="existingLink"></EditUrlModal>
|
||||||
|
|||||||
@ -8,9 +8,9 @@ const LOCAL_STORAGE_KEY = 'rssalchemy_store_wizard';
|
|||||||
export const useWizardStore = defineStore('wizard', () => {
|
export const useWizardStore = defineStore('wizard', () => {
|
||||||
|
|
||||||
const locStorageContent = localStorage.getItem(LOCAL_STORAGE_KEY);
|
const locStorageContent = localStorage.getItem(LOCAL_STORAGE_KEY);
|
||||||
const defaultSpecs = locStorageContent ? JSON.parse(locStorageContent) as Specs : emptySpecs;
|
const initialSpecs = locStorageContent ? JSON.parse(locStorageContent) as Specs : emptySpecs;
|
||||||
|
|
||||||
const specs = reactive(defaultSpecs);
|
const specs = reactive(Object.assign({}, initialSpecs));
|
||||||
|
|
||||||
const formValid = computed(() => {
|
const formValid = computed(() => {
|
||||||
return fields.every(field => (
|
return fields.every(field => (
|
||||||
@ -30,6 +30,10 @@ export const useWizardStore = defineStore('wizard', () => {
|
|||||||
Object.assign(specs, newValue);
|
Object.assign(specs, newValue);
|
||||||
updateLocalStorage();
|
updateLocalStorage();
|
||||||
}
|
}
|
||||||
|
function reset() {
|
||||||
|
Object.assign(specs, emptySpecs);
|
||||||
|
updateLocalStorage();
|
||||||
|
}
|
||||||
|
|
||||||
return {specs, formValid, updateSpec, updateSpecs};
|
return {specs, formValid, updateSpec, updateSpecs, reset};
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user