diff --git a/src/store/mqtt.ts b/src/store/mqtt.ts
index edbeed7..6b044da 100644
--- a/src/store/mqtt.ts
+++ b/src/store/mqtt.ts
@@ -10,7 +10,8 @@ export const useMqttStore = defineStore('mqtt', {
clientId: 'R328328',
forceRawTime: false,
normalizedTime: false,
- coolDownTime: 0
+ coolDownTime: 0,
+ loopPlayback: true
}
},
persist: {
diff --git a/src/views/mqtt/index.vue b/src/views/mqtt/index.vue
index 7ce0f7a..8048881 100644
--- a/src/views/mqtt/index.vue
+++ b/src/views/mqtt/index.vue
@@ -18,9 +18,10 @@ const url = $toRef(mqttStore, 'url')
const username = $toRef(mqttStore, 'username')
const password = $toRef(mqttStore, 'password')
const clientId = $toRef(mqttStore, 'clientId')
-let forceRawTime = $toRef(mqttStore, 'forceRawTime')
-let normalizedTime = $toRef(mqttStore, 'normalizedTime')
-let coolDownTime = $toRef(mqttStore, 'coolDownTime')
+const forceRawTime = $toRef(mqttStore, 'forceRawTime')
+const normalizedTime = $toRef(mqttStore, 'normalizedTime')
+const coolDownTime = $toRef(mqttStore, 'coolDownTime')
+const loopPlayback = $toRef(mqttStore, 'loopPlayback')
let loading = $ref(false)
const dataLib = reactive(dataLib0)
@@ -137,6 +138,13 @@ async function doPublish() {
publish.rawTime = true
// 发送数据的定时器
const interval = setInterval(() => {
+ // 判断取消循环播放
+ if (!loopPlayback) {
+ if (publish.index == list.length - 1) {
+ jobCancel.value?.()
+ return
+ }
+ }
// 判断定时器被关闭
if (exit) {
clearInterval(interval)
@@ -310,15 +318,17 @@ watch(