How to trim the array if length is > 5

后端 未结 2 391
失恋的感觉
失恋的感觉 2021-01-27 04:25

How to trim the array if length is > 5

My JSON is:

{
        \"name\": \"aaa\"
        \"files\": [
            {
                \"name\": \"A\",
               


        
2条回答
  •  抹茶落季
    2021-01-27 05:04

    I suppose you want to keep the full array in your logic, and only trim it in your HTML. If this is the case, just use Array.prototype.slice() where you want to display the trimmed list.

    I.e.

    {{i}}

提交回复
热议问题