Home > Web Front-end > Vue.js > body text

How to convert array to string in vue.js

王林
Release: 2023-01-13 00:45:46
Original
6646 people have browsed it

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
Copy after login

How to convert array to string in vue.js

String to array

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template