学习机3.4.0版本
This commit is contained in:
@@ -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 })
|
||||
|
||||
Reference in New Issue
Block a user