vue.js怎么实现数组转字符串

来自:互联网
时间:2021-09-30
阅读:

vue.js实现数组与字符串之间的相互转换,具体代码如下所示:

数组转字符串

vue.js怎么实现数组转字符串

var  authority= ['1','2'];
let permission = authority.join(",");
console.log(permission )//1,2

vue.js怎么实现数组转字符串

字符串转数组

var a='1,2'
a.split(',')
console.log(a)// ["1", "2"]
返回顶部
顶部