add new jtag cmd : read status reg
This commit is contained in:
@@ -3,13 +3,45 @@
|
||||
<div class="h-full w-32"></div>
|
||||
|
||||
<div class="h-full w-[70%] shadow-2xl flex">
|
||||
|
||||
<p>{{ logText }}</p>
|
||||
|
||||
<button class="btn btn-primary h-10 w-30">获取ID Code</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup></script>
|
||||
<script lang="ts" setup>
|
||||
import { ref } from "vue";
|
||||
const eventSource = new EventSource("http://localhost:5000/api/log");
|
||||
const logText = ref("");
|
||||
|
||||
// 启动SSE连接
|
||||
function startStream() {
|
||||
eventSource.onmessage = function (e) {
|
||||
logText.value = e.data;
|
||||
};
|
||||
|
||||
eventSource.onerror = function (err) {
|
||||
console.error("Error:", err);
|
||||
eventSource.close();
|
||||
};
|
||||
|
||||
eventSource.onopen = function () {
|
||||
console.log("Connection opened");
|
||||
};
|
||||
}
|
||||
|
||||
// 停止SSE连接
|
||||
function stopStream() {
|
||||
if (eventSource) {
|
||||
eventSource.close();
|
||||
console.log("Connection closed");
|
||||
}
|
||||
}
|
||||
|
||||
// 页面加载时自动启动
|
||||
window.onload = startStream;
|
||||
</script>
|
||||
|
||||
<style scoped lang="postcss">
|
||||
@import "../assets/main.css";
|
||||
|
Reference in New Issue
Block a user