My code like this :
<template>
...
<p v-for="club in clubs">{{club}}</p>
...
</template>
<script>
export default {
data: () => ({
clubs: ''
}),
mounted () {
let dataClub = "- City\\t - MU\\t - Liverpool\\t - Arsenal\\t - Chelsea"
// let dataClub = "- City\n - MU\n - Liverpool\n - Arsenal\n - Chelsea"
// let dataClub = "City;MU;Liverpool;Arsenal;Chelsea"
let dc = dataClub.split(/[\n;]/)
this.clubs = dc
}
}
</script>
dataClub is dynamic. It can be separated with ;
and can also be separated with \n
. Other than that it can also be separated by the sign \\t
How can I do a split if there are 3 separators?
I try let dc = dataClub.split(/[\n;\\t]/)
, but it does not works