Implémentation du mqtt-button
This commit is contained in:
parent
c10bb714a9
commit
de18d4957b
22
src/components/MqttButton.vue
Normal file
22
src/components/MqttButton.vue
Normal file
@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<v-btn @click="_publishMessage" v-bind="$attrs">
|
||||
<slot/>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { publishMessage } from '@/services/mqttService'
|
||||
import { ref, defineProps } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
topic: String,
|
||||
message: null
|
||||
})
|
||||
|
||||
const disabled = ref(false)
|
||||
|
||||
const _publishMessage = () => {
|
||||
publishMessage(props.topic, JSON.stringify(props.message))
|
||||
disabled.value = true
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user