Commit 69fbe438 by 周田

test:点击按钮添加表格显示相关性能设备性能数据

parent 03d5702c
...@@ -14,7 +14,8 @@ type propsType = { ...@@ -14,7 +14,8 @@ type propsType = {
const props = defineProps<propsType>() const props = defineProps<propsType>()
type tableDataType = Record<string, string>[] type tableDataType = Record<string, string>[]
const tableData = ref<tableDataType>([{}]); // const tableData = ref<tableDataType>([{}]);
const tableData = ref<tableDataType>([{}])
onMounted(() => { onMounted(() => {
let table_websocket = new WebSocket( let table_websocket = new WebSocket(
......
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, watch } from 'vue'; import { ref, onMounted, watch } from 'vue';
import { ElScrollbar, ElInput, ElButton } from 'element-plus'; import { ElScrollbar, ElInput, ElButton } from 'element-plus';
import { ElMessage, ElMessageBox } from 'element-plus'
import DevicePerformanceTable from '@/components/DevicePerformanceTabel' import DevicePerformanceTable from '@/components/DevicePerformanceTabel'
const innerRef = ref<HTMLDivElement>(); const innerRef = ref<HTMLDivElement>();
...@@ -58,6 +59,27 @@ onMounted(() => { ...@@ -58,6 +59,27 @@ onMounted(() => {
}; };
}) })
const deviceTableParams = ref<string[]>([]);
const addDeviceTable = () => {
ElMessageBox.prompt('Please input WebSocket group name', 'Tip', {
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
})
.then(({ value }) => {
ElMessage({
type: 'success',
message: `new websocket group name is chat_${value}`,
})
deviceTableParams.value.push(value);
})
.catch(() => {
ElMessage({
type: 'info',
message: 'Input canceled',
})
})
}
</script> </script>
<template> <template>
...@@ -73,8 +95,8 @@ onMounted(() => { ...@@ -73,8 +95,8 @@ onMounted(() => {
<el-input v-model="input" placeholder="Please input" @keyup.enter="send"></el-input> <el-input v-model="input" placeholder="Please input" @keyup.enter="send"></el-input>
<el-button @click="send">Send</el-button> <el-button @click="send">Send</el-button>
<device-performance-table group-name="acu7m5" mt-5 /> <device-performance-table v-for="param in deviceTableParams" mt-5 :group-name="param" :key="param" />
<device-performance-table group-name="hwf" mt-5/> <el-button @click="addDeviceTable" class="mt-5" >Add table</el-button>
</template> </template>
<style scoped> <style scoped>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment