flex布局 实现进度条

效果图

文字

vue template模板

mounted 挂载

methods 后台接口

// An highlighted block
 [点击并拖拽以移动]



<template>
  <div class="pro">
    <div class="prok"><i class="pro1">看涨{{progress}}%</i><i class="pro2">看跌{{progress1}}%</i></div>
    <div id="probar">
      <div :style="{width:progress+'%'}"></div>
      <div :style="{width:progress1+'%'}"></div>
    </div>
  </div>
</template>
<script type="text/babel">
export default {
  data () {
    return {
      stockName: '',
      progress: 50,
      progress1: 50
    }
  },
  mounted: function () {
    this.get_progress()
  },
  methods: {
    get_progress () {
      this.axios.get(this.linkPrefix + '/message_api/public_opoinion', {
        params: {
          stockcode: this.$route.query.num
        }
      }
      ).then(response => {
        this.progress = response.data.data.progress
        this.progress1 = response.data.data.progress1
      })
    }
  }
}
</script>
<style lang="stylus" rel="stylesheet/stylus">
  .pro
    position relative
    margin-top .8rem
  .prok i
    position absolute
    top -.45rem
  .pro1
    position absolute
    left 0
    color #10907a
  .pro2
    position absolute
    right 0
    color #ed5a00
  #probar
    position relative
    width 100%
    height .4rem
    display flex
    border-radius .6rem
    overflow hidden
  #probar div:nth-child(1)
    background-color #10907a
  #probar div:nth-child(2)
    background-color #ed5a00

</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值