Copy to local sticker. On submit copy back to original.
This commit is contained in:
parent
7a7d4540a9
commit
e60362c220
1 changed files with 10 additions and 5 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { ref, toRaw, watch } from 'vue'
|
||||
|
||||
import Button from 'primevue/button';
|
||||
import Card from 'primevue/card';
|
||||
|
|
@ -18,10 +18,16 @@ import IconLayout3Vue from '@/components/layouts/IconLayout3.vue';
|
|||
import IconLayout4Vue from '@/components/layouts/IconLayout4.vue';
|
||||
import Sticker from '@/components/Sticker.vue';
|
||||
import { useSticker } from '@/composables/sticker'
|
||||
import { activist, type Sticker as StickerType } from '@/stores/stickersStore'
|
||||
|
||||
|
||||
const sticker = useSticker();
|
||||
const original = useSticker();
|
||||
let sticker = ref<StickerType>(activist);
|
||||
|
||||
// When the original sticker appears, copy it into a local coy.
|
||||
watch(original, (newValue, oldValue) => {
|
||||
sticker.value = structuredClone(toRaw(newValue));
|
||||
});
|
||||
|
||||
const checked = ref(true);
|
||||
const selectedCountry = ref(null);
|
||||
|
|
@ -49,9 +55,8 @@ const resolver = () => {
|
|||
return {};
|
||||
};
|
||||
|
||||
|
||||
function onFormSubmit() {
|
||||
return {};
|
||||
original.value = sticker.value;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -171,7 +176,7 @@ function onFormSubmit() {
|
|||
<div class="divider" />
|
||||
|
||||
<div class="col-span-12">
|
||||
<Button label="Save Changes" class="w-auto mt-4" />
|
||||
<Button label="Save Changes" class="w-auto mt-4" type="submit" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue