//html部分
<span style="overflow: hidden;" class="nickname-sp2">
<span class="name over-ellipse q-t-nickname nickname-l2">'+item.nickname+'</span>
</span>
//js部分
//给名字为2个字的 设置间距
$('.nickname-sp2').each(function(){
var that=this
var nickSize=$(that).children(".nickname-l2").text().length
if(nickSize==2){
$(that).children(".nickname-l2").css({"letter-spacing":"1em","margin-right":"-1em"})
}
})
//效果图
![](https://img2020.cnblogs.com/blog/1469477/202007/1469477-20200713170252401-1783097009.png)