当前位置:网站首页>[quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched
[quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched
2022-07-01 18:59:00 【Huawei Developer Forum】
【 Phenomenon description 】
When text When the content of components is more than one line , The adjacent div The style displays an exception , Will change from a normal circle to an ellipse .
The code is as follows :
<template> <div class="container"> <div style="align-items: center;"> <div class="typscolor" style="background-color: blue; opacity: 0.26; margin-left: 16px;"></div> <text>{{text}}</text> <div class="typscolor" style="background-color: blue; opacity: 0.26; margin-left: 16px;"></div> <text>{{text}}</text> <div class="typscolor" style="background-color: blue; opacity: 0.26; margin-left: 16px;"></div> <text>{{text}}</text> </div> </div></template><style> .container { flex-direction: column; justify-content: center; height: 100%; } text { font-size: 24px; } .typscolor { border-radius: 50%; width: 30px; height: 30px; background-color: red; margin-right: 8px; }</style><script> module.exports = { data: { text:'text When there is too much text, the circle on the left will be stretched ' }, onInit() { }, } </script>As shown in the figure
abnormal

normal

【 Problem analysis 】
When text When there are too many components ,flex When the width exceeds the layout, it will be automatically compressed , Which leads to div The label is stretched
【 resolvent 】
You can give div Label settings flex-shrink: 0 attribute , To solve the problem
The sample code is as follows :
<template> <div class="container"> <div style="align-items: center;"> <div class="typscolor" style="background-color: blue; opacity: 0.26; margin-left: 16px;"></div> <text>{{text}}</text> <div class="typscolor" style="background-color: blue; opacity: 0.26; margin-left: 16px;"></div> <text>{{text}}</text> <div class="typscolor" style="background-color: blue; opacity: 0.26; margin-left: 16px;"></div> <text>{{text}}</text> </div> </div></template><style> .container { flex-direction: column; justify-content: center; height: 100%; } text { font-size: 24px; } .typscolor { border-radius: 50%; width: 30px; height: 30px; background-color: red; margin-right: 8px; flex-shrink: 0; /* Add this attribute to solve the stretching problem */ }</style><script> module.exports = { data: { text:'text When there is too much text, the circle on the left will be stretched ' }, onInit() { }, } </script>As shown in the figure :

For more details , Please see the :
Huawei official website :
https://developer.huawei.com/consumer/cn/forum/topic/0203908673278080243?fid=23?ha_source=zzh
边栏推荐
- Intensive cultivation of channels for joint development Fuxin and Weishi Jiajie held a new product training conference
- Vidéos courtes recommandées chaque semaine: méfiez - vous de la confusion entre « phénomène » et « problème »
- Technology implementation and Architecture Practice
- 搭建一個通用監控告警平臺,架構上需要有哪些設計
- GameFramework食用指南
- ES6数组方法find()、findIndex()的总结「建议收藏」
- 搭建一个通用监控告警平台,架构上需要有哪些设计
- 洞态在某互联⽹⾦融科技企业的最佳落地实践
- How to realize the applet in its own app to realize continuous live broadcast
- app发版后的缓存问题
猜你喜欢

Lumiprobe非荧光炔烃丨EU(5-乙炔基尿苷)

Graduation season | Huawei experts teach the interview secret: how to get a high paying offer from a large factory?

创建您自己的NFT集合并发布一个Web3应用程序来展示它们(介绍)

宏观视角看抖音全生态

1. "Create your own NFT collections and publish a Web3 application to show them." what is NFT

LiveData postValue会“丢”数据

Docker deploy mysql8.0

Halcon image calibration enables subsequent image processing to become the same as the template image

Lumiprobe 生物分子定量丨QuDye 蛋白定量试剂盒

Huawei cloud experts explain the new features of gaussdb (for MySQL)
随机推荐
ES6数组去重的三个简单办法
Altair HyperWorks 2022 software installation package and installation tutorial
ES6 summary "suggestions collection" of array methods find(), findindex()
How to realize the applet in its own app to realize continuous live broadcast
11. Users, groups, and permissions (1)
Li Kou daily question - Day 32 -589 N × Preorder traversal of tree
研究了11种实时聊天软件,我发现都具备这些功能…
为什么独立站卖家都开始做社交媒体营销?原来客户转化率能提高这么多!
Clean up system cache and free memory under Linux
Viewing the whole ecology of Tiktok from a macro perspective
字节跳动数据平台技术揭秘:基于 ClickHouse 的复杂查询实现与优化
C language learning notes: type definition typedef and declaration external CSDN creation punch in
How to find the optimal learning rate
关于企业中台规划和 IT 架构微服务转型
Salesmartly has some tricks for Facebook chat!
实现一个Prometheus exporter
2020, the regular expression for mobile phone verification of the latest mobile phone number is continuously updated
What designs are needed in the architecture to build a general monitoring and alarm platform
PriorityQueue的用法和底层实现原理
磁盘的基本知识和基本命令