Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
725 views
in Technique[技术] by (71.8m points)

JavaScript 多行字符串对齐

json格式数据如下:
    [{'name':'张三','pcs':'40','total':'3600'},
    {'name':'李老五','pcs':'2','total':'400'},
    {'name':'Jack','pcs':'121','total':'59800'},
    {'name':'王-ADU','pcs':'21','total':'1130'}]
拼接成字符串,用 js 怎样解决对齐问题,请大神帮助下,万分感谢!

张三 40单 3600件
李老五 2单 400件
Jack 121单 59800件
王-ADU 21单 1130件

想要达到的效果如下图

image


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

你这不是table吗,样式自己写下就行了,;
左对齐 text-align:left;
右对齐 text-align:right;
还是我理解错你的意思了???


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...