Hi i wanna try to formate text to break line after ***
this is only part of the script i think the problem is on computed part maybe i wrote something wrong i have already tried this:
<div v-html="post.case_history"></div>
and this:
computed() {
post.case_history.replace('***', '<br>')
}
I got this error
Invalid value for option "computed": expected an Object, but got Function.
computed: {
postCased: function() {
return this.post.case_history.replace('***', '<br>')
}
}
-
<div v-html="postCased"></div>
Thanks lot i have found the solution:
<div v-html="history(post)"></div>
methods: {
history(post) {
return post.case_history.replace('***', '<br>') . replace(/\*\*\*/g, '<br>').replace(/------------------------------/g, '<br>');
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.