"Fossies" - the Fresh Open Source Software Archive

Member "frp-0.36.2/web/frps/src/components/Traffic.vue" (22 Mar 2021, 938 Bytes) of package /linux/misc/frp-0.36.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) vue.js (beta) source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 <template>
    2     <div :id="proxy_name" style="width: 600px;height:400px;"></div>
    3 </template>
    4 
    5 <script>
    6 import {DrawProxyTrafficChart} from '../utils/chart.js'
    7 export default {
    8     props: ['proxy_name'],
    9     created() {
   10         this.fetchData()
   11     },
   12     //watch: {
   13         //'$route': 'fetchData'
   14     //},
   15     methods: {
   16         fetchData() {
   17             let url = '../api/traffic/' + this.proxy_name
   18             fetch(url, {credentials: 'include'})
   19               .then(res => {
   20                 return res.json()
   21               }).then(json => {
   22                 DrawProxyTrafficChart(this.proxy_name, json.traffic_in, json.traffic_out)
   23               }).catch( err => {
   24                   this.$message({
   25                       showClose: true,
   26                       message: 'Get server info from frps failed!' + err,
   27                       type: 'warning'
   28                     })
   29               })
   30         }
   31     }
   32 }
   33 </script>
   34 
   35 <style>
   36 </style>