美文网首页
小程序---多个空格

小程序---多个空格

作者: G_whk | 来源:发表于2019-03-08 11:45 被阅读0次
在微信小程序中,连续多个空格也只会被显示成一个空格。解决这个问题有两种方法。

第一种:

<view>
    <text space="ensp">你好,      哈哈哈(空格是中文字符一半大小)</text>
</view>
<view>
    <text space="emsp">你好,      哈哈哈(空格是中文字符大小)</text>
</view>
<view>
    <text space="nbsp">你好,      哈哈哈(空格根据字体设置)</text>
</view>

第二种:

<view>
    <text decode="{{true}}">你好,&ensp;&ensp;&ensp;哈哈哈(空格是中文字符一半大小)</text>
</view>
<view>
    <text decode="{{true}}">你好,&emsp;&emsp;&emsp;哈哈哈(空格是中文字符大小)</text>
</view>
<view>
    <text decode="{{true}}">你好,&nbsp;&nbsp;&nbsp;哈哈哈(空格根据字体设置)</text>
</view>

Attention

以上方法仅对<text></text>标签有效。

相关文章

网友评论

      本文标题:小程序---多个空格

      本文链接:https://www.haomeiwen.com/subject/bfxrpqtx.html