Vue数组互传

2019-11-28  本文已影响0人  前端切图仔

如:const num1=[1,2,3],const num2=[55,5,5],都要加在一个空数组中 const to=[]

1.遍历:

for(let n of num1){

to.push(n)

}    然后第二个在遍历

2.利用push函数,可变参数   ...三个点可以解析数组

to.push(...num1)

上一篇 下一篇

猜你喜欢

热点阅读