Home >Web Front-end >Vue.js >How to convert array to string in vue.js

How to convert array to string in vue.js

王林
王林Original
2021-09-29 16:31:146675browse

vue.js method to convert array to string: [var authority= ['1','2'];let permission = authority.join(",");console.log(permission )] .

How to convert array to string in vue.js

The operating environment of this article: windows10 system, vue.js 2.9, thinkpad t480 computer.

vue.js implements mutual conversion between arrays and strings. The specific code is as follows:

Array to string

How to convert array to string in vue.js

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

How to convert array to string in vue.js

String to array

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

Recommended learning: php training

The above is the detailed content of How to convert array to string in vue.js. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn