2024-02-26 11:27:27 +01:00
|
|
|
<template>
|
2024-09-11 15:38:13 +02:00
|
|
|
<v-btn @click="_publishMessage" v-bind="$attrs">
|
|
|
|
<slot/>
|
|
|
|
</v-btn>
|
2024-02-26 11:27:27 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
2024-09-11 15:38:13 +02:00
|
|
|
import { publishMessage } from '@/services/mqttService'
|
|
|
|
import { ref, defineProps } from 'vue'
|
2024-02-26 11:27:27 +01:00
|
|
|
|
2024-09-11 15:38:13 +02:00
|
|
|
const props = defineProps({
|
|
|
|
topic: String,
|
|
|
|
message: null
|
|
|
|
})
|
2024-02-26 11:27:27 +01:00
|
|
|
|
2024-09-11 15:38:13 +02:00
|
|
|
const disabled = ref(false)
|
2024-02-26 11:27:27 +01:00
|
|
|
|
2024-09-11 15:38:13 +02:00
|
|
|
const _publishMessage = () => {
|
2024-11-18 22:45:51 +01:00
|
|
|
publishMessage(props.topic, props.message)
|
2024-09-11 15:38:13 +02:00
|
|
|
disabled.value = true
|
|
|
|
}
|
2024-02-26 11:27:27 +01:00
|
|
|
</script>
|