微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在SwiftUI中动画期间文本会缩短

如何解决在SwiftUI中动画期间文本会缩短

我尝试构建一个可扩展的菜单,该文本应限制为2行,但是当文本较长且菜单被扩展时,在动画过程中该文本将缩短...。

<input id="elastic" class="search-bar" type="text" placeholder="Search Anything Here...">

<div id="sort">
  <a id="sort-best" class="choose-cat" data-order="3,1,2">best</a> |
  <a id="sort-default" class="choose-cat" data-order="1,2,3">default</a>
</div>

<div id="game-items-cart" class="elastic">
<span id="no-result-id" class="no-result hide">no result</span>
  <article data-custom-sort="1">
    <h3 class="card-hide-title">One</h3>
  </article>
  <article data-custom-sort="2">
    <h3 class="card-hide-title">Two</h3>
  </article>
  <article data-custom-sort="3">
    <h3 class="card-hide-title">Three</h3>  
  </article>


</div>

enter image description here

解决方法

解决方案是将.fixedSize(horizontal: false,vertical: true)应用于Text

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。