Is there a way to insert a line break in Vue whenever there is a ↵ character?
I attempted to implement the solution from this Stack Overflow thread, but I am encountering difficulties.
Here is what I have tried:
var app = new Vue({
el: '#app',
data() {
return {
a: {
country: "England:↵ - Liverpool↵ - Chelsea↵ - Arsenal↵ - MU↵ - City",
},
testObj: "",
};
},
computed: {
jsonFunc() {
return (this.testObj = this.a.country.replace(/↵/g, "<br/>"));
},
},
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<div>
Vue
{{ jsonFunc }}
</div>
</div>