微信小程序开发学习小结之-text和rich-text组件.

差异:

1.text是一个文本组件,而rich-text是一个富文本组件.

2.前者类似于html中的spon标签,是一个行内元素.后者支持把html字符串渲染为vxml结构.

text组件基本使用:

1.可以通过selecttable来控制文本内容是否可以长按选中.(官方文档声明现在select已经弃用将使用user-select代替,但就博主发表这篇博客为止,两者都能使用).

rich-text组件基本使用方法:

1.通过node属性来指定想要渲染的html字符串.

样例:

 

<view class="box" >     
  <view class="Telephone">  
   <image class="Telephone-image" src="../../images/contact/telephone.png"> </image> 
   <text  class="email-text">  </text>
   <view class="Telephone-text">   电话:</view>
  <text class="Telephone-text"  selectable="true" >13409269663</text>
 </view>
 <view class="email">  
   <image class="email-image" src="../../images/contact/email.png"> </image> 
   <text  class="email-text">  </text>
   <view class="email-text">   邮箱:</view>
  <text  class="email-text" user-select="ture">2097676238@qq.com</text>
 </view>
</view>

 

 

posted @   冷月半明  阅读(146)  评论(0编辑  收藏  举报  
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
点击右上角即可分享
微信分享提示