学习机3.4.0版本

This commit is contained in:
2023-11-29 16:08:12 +08:00
parent 770ca0df44
commit 4e86989fcd
3688 changed files with 3708 additions and 1839 deletions

View File

@@ -8,14 +8,11 @@
<script setup lang="ts">
import { ref } from 'vue'
import { NGrid, NGi, useMessage } from 'naive-ui'
import { NGrid, NGi } from 'naive-ui'
import convert from 'color-convert'
import LED from './components/LED.vue'
import { useSerialPortStore } from '@/stores/serialPort'
import { ROWS, COLS } from './data'
const message = useMessage()
let color
const changeColor = (value) => {
if (!value) return
@@ -30,12 +27,7 @@ const clear = () => {
ledRef.changeColor('#000000')
});
}
const serialPort = useSerialPortStore()
const onClick = (index: number) => {
if (!serialPort.isOpen) {
message.error('请连接并打开串口设备')
return
}
if (!color) return
ledRefs.value[index].changeColor(color)
@@ -49,7 +41,7 @@ const onClick = (index: number) => {
cmd += cmd.length
cmd += '\r\n'
serialPort.write(cmd)
window.ipcRenderer.send('COM_WRITE',cmd)
}
defineExpose( { changeColor, clear })