antdv Progress 进度条 实现环内内容换行 踩坑避雷

2 篇文章 0 订阅
2 篇文章 0 订阅

修改前样式                                                        修改后样式         

                                        

问题:在API format属性内换行符 /n 失效、

解决方法: ①添加样式 style=“white-space: pre;” 识别 ‘\n’

                ②css 样式定位到需要换行的元素 新增属性"white-space: pre-wrap;"

未修改前代码:

          <a-progress type="circle"
                      :width="120"
                      :strokeWidth="10"
                      :format="percent => `30`  + '\n\n'+ `未完成`"
                      :percent="30"
                      stroke-linecap="square"
          >

①修改后代码:

          <a-progress type="circle"
                      :width="120"
                      style="white-space: pre;"
                      :strokeWidth="10"
                      :format="percent => `30`  + '\n\n'+ `未完成`"
                      :percent="30"
                      stroke-linecap="square"
          >

② 修改后css 样式

/deep/ant-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  margin: 0;
  padding: 0;
  color: rgba(0, 0, 0, 0.65);
  line-height: 1;
  text-align: center;
  transform: translate(-50%, -50%);
  white-space: pre-wrap !important;  //提高指定样式规则的应用优先权(优先级)
}

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值