frp/web/frps/src/components/Traffic.vue

33 lines
740 B
Vue
Raw Normal View History

2017-03-27 02:15:31 +08:00
<template>
<div :id="proxyName" style="width: 600px; height: 400px"></div>
2017-03-27 02:15:31 +08:00
</template>
<script setup lang="ts">
import { ElMessage } from 'element-plus'
import { DrawProxyTrafficChart } from '../utils/chart.js'
const props = defineProps<{
proxyName: string
}>()
const fetchData = () => {
let url = '../api/traffic/' + props.proxyName
fetch(url, { credentials: 'include' })
.then((res) => {
return res.json()
})
.then((json) => {
DrawProxyTrafficChart(props.proxyName, json.trafficIn, json.trafficOut)
})
.catch((err) => {
ElMessage({
showClose: true,
message: 'Get traffic info failed!' + err,
type: 'warning',
})
})
2017-03-27 02:15:31 +08:00
}
fetchData()
2017-03-27 02:15:31 +08:00
</script>
<style></style>