zoukankan      html  css  js  c++  java
  • 知识点3: 动态数据接入

    效果图:

     

    html

    (事先封装好了counter标签)

            <div class="count">
              <counter :data="num1" :config="config1"></counter>
            </div>

    js

     // num1配置,此处是静态的,尚未接入数据,自己添加一个数字就好
         num1: 11,
    
     // config配置
            config1: {
              justifyContent: "flex-start",
                numbers: {
                  // 数字配置项
                  textStyle: {
                    color: "#faef6d",
                    fontSize: 20,
                    // fontFamily: "PixelLCD-7",
                    fontFamily: "MF_LangQian",  
                    fontWeight: "normal"              
                  },
                  animateFlag: true,
                  animateType: "scroll",
                  letterSpacing: 0 // 数字之间间距
                },
                suffix: {
                  // 后缀配置项
                  content: "%",
                  marginLeft: 2,
                  textStyle: {
                    color: "#faef6d",
                    fontSize: 20,
                    fontWeight: "normal",
                    fontFamily: "lihei"
                  }
                }
    
            },

    数据接入(sl0061是动态地址)

        methods: {
          loadData(){
            this.$http.indi.get('sl0061', {}, (res) => {
                if (res.data.data.length > 0 || res.data.data) {
                  options.option1.series[0].data[0].name = res.data.data[0].KPI_VALUE4 
                  options.option1.series[0].data[1].name = res.data.data[0].KPI_VALUE2 
                  options.option1.series[0].data[2].name = res.data.data[0].KPI_VALUE1 
                  options.option1.series[0].data[3].name = res.data.data[0].KPI_VALUE3
                }
         }
        }       
          mounted() {
            this.loaddata()
          },
    致力于前端技术学习与分享,会及时更新博客。
  • 相关阅读:
    第08组 Alpha冲刺 (2/6)
    第08组 Alpha冲刺 (1/6)
    结对编程作业
    第01组 Alpha冲刺总结
    第01组 Alpha冲刺(6/6轮)
    第01组 Alpha冲刺(6/6)
    第01组 Alpha冲刺(5/6)
    第01组 Alpha冲刺(5/6轮)
    第01组 Alpha冲刺(4/6)
    第01组 Alpha冲刺(3/6)
  • 原文地址:https://www.cnblogs.com/caoxueying2018/p/9871667.html
Copyright © 2011-2022 走看看