h5的canvas重置画布

   /**
           * 清除画布的方法
           * x 是要清除的矩形左上角的 x 坐标,y 是要清除的矩形左上角的 y 坐标
           * /width 是要清除的矩形的宽度,以像素计,height 是要清除的矩形的高度,以像素计
          //  */
   		  <canvas
            id="ecgCanvas"
            ref="ecg"
            width="608px"
            height="386px"
          ></canvas>

    this.$nextTick(() => {
    
    
            this.$refs.ecg.height = this.$refs.ecg.height;
            // var context = canvas.getContext("2d");
            // context.clearRect(0, 0, 608, 385);
          });

//直接重新给高赋值最好用,特别是组件弹窗中

猜你喜欢

转载自blog.csdn.net/qq_38594056/article/details/118523205