vue移动端的坑

Echarts水球图在ios上特别卡,使用纯css3组件代替

水球组件代码如下:

<template>
  <div class="battery">
    <div class="cover" :style="{ '--progress': progress + '%' }"></div>
    <div class="num">{{ parseFloat(text).toFixed(2) + '%' }}</div>
  </div>
</template>
<script>
export default {
  name: 'Water',
  props: {
    progress: {
      // 水球水位进度
      type: Number,
      default: 0
    },
    text: {
      // 水球显示百分比
      type: Number,
      default: 0
    }
  }
}
</script>

<style scoped lang="scss">
.num {
  z-index: 2;
  color: #fff;
  font-size: 24px;
}
.battery {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 87.5px;
  height: 87.5px;
  border-radius: 50%;
}
.battery::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border: 1px solid #313741;
  background: linear-gradient(135deg, #04bdf8 30.52%, #01e7af 100%, #01e4b4 100%);
  border-radius: 50%;
  top: 0;
}
.cover {
  width: 100%;
  height: 100%;
  text-align: center;
  color: #fff;
  line-height: 125px;
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  z-index: 1;
  overflow: hidden;
}
.cover::before,
.cover::after {
  content: '';
  position: absolute;
  left: -50%;
  width: 200px;
  height: 200px;
}
.cover::before {
  background-color: #313741;
  opacity: 0.8;
  border-radius: 40% 30%;
  animation: rotate1 10s linear infinite;
}
.cover::after {
  background-color: #313741;
  opacity: 0.7;
  border-radius: 42% 40%;
  animation: rotate2 10s linear infinite;
}
@keyframes rotate1 {
  0% {
    transform: rotate(0deg);
    bottom: var(--progress); /*控制进度*/
  }
  100% {
    transform: rotate(360deg);
    /* bottom: 20%; */
    bottom: var(--progress);
  }
}
@keyframes rotate2 {
  0% {
    transform: rotate(45deg);
    bottom: var(--progress);
  }
  100% {
    transform: rotate(360deg);
    bottom: var(--progress);
  }
}
</style>

父组件调用代码

<water
    :key="datekey"
    v-if="isLoaded && rate !== null"
    :progress="
    Number(rate ) > 100 ? 100 : Number(rate )"
    :text="Number(rate)"
/>
<script>
export default {
  name: 'DataOverview',
  components: { Water },
  data() {
    return {
        rate:null,
        isLoaded: false,
        datekey: Date.now()
    }
  },
  mounted(){
    this.getSchedule()
  },
  methods:{
    getSchedule() {
      getSchedule(this.params).then(res => {
        this.rate= res.data.rate
        this.isLoaded = true
        this.datekey = Date.now()
      })
    },
  }

 注意:datekey不能省略,否则样式不会更新

vant日历,最小到最大日期范围过大时,在ios上初始化会不显示,解决办法,给日历组件一个高

<template>
  <div :class="theme">
    <van-calendar
      v-model="show"
      :min-date="minDate"
      :max-date="maxDate"
      :default-date="currentDate"
      color="#1890FF"
      @confirm="confirm"
      @close="cancel"
      //关键代码
      :style="{ height: '500px' }"
      :show-confirm="false"
    />
  </div>
</template>

Echarts折线图来回切换数据导致线错乱

myChart.clear();
myChart.setOption(option);
myChart.resize();

video标签在ios浏览器上自动全屏播放,加入playsinline属性解决,完整代码如下

<video :src="path" loop autoplay muted :playsinline="true"></video>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值