actuel-inactuel/site/plugins/send-button/src/components/SendButtonField.vue
2024-10-16 08:53:53 +02:00

37 lines
611 B
Vue
Executable file

<template>
<k-button @click="send($event)" variant="filled" icon="plane">{{
text
}}</k-button>
</template>
<script setup>
import { ref } from "vue";
const { pageUri } = defineProps({
pageUri: String,
});
const text = ref("Envoyer");
const headers = {
method: "POST",
body: JSON.stringify({
pageUri,
}),
};
function send(event) {
event.preventDefault();
fetch("/send-newsletter.json", headers)
.then((res) => res.json())
.then((json) => console.log(json));
}
</script>
<style scoped>
@media screen and (min-width: 533px) {
button {
margin-top: 2.15rem;
}
}
</style>