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

27 lines
517 B
Vue
Raw Normal View History

2017-03-26 18:15:31 +00:00
<template>
2020-12-03 12:20:48 +00:00
<div :id="proxyName" style="width: 600px; height: 400px" />
2017-03-26 18:15:31 +00:00
</template>
<script>
2020-12-03 12:20:48 +00:00
import { DrawProxyTrafficChart } from '../utils/chart.js'
2017-03-26 18:15:31 +00:00
export default {
2020-12-03 12:20:48 +00:00
props: {
proxyName: {
type: String,
required: true
2017-03-26 18:15:31 +00:00
}
2020-12-03 12:20:48 +00:00
},
mounted() {
this.initData()
},
methods: {
async initData() {
const json = await this.$fetch(`traffic/${this.proxyName}`)
if (!json) return
DrawProxyTrafficChart(this.proxyName, json.traffic_in, json.traffic_out)
}
}
2017-03-26 18:15:31 +00:00
}
</script>