Vue has obtained the back-end data, how to wrap it?


HTML

get the backend data code


Let the backend return the tagged form to you:

1.xxx < br/ > 2.xxx < br/ >

I don't think it's reasonable to deal with the front end. Although the front end can handle it.
first of all, the content given to you at the back end should be dynamic, that is, the text is generated dynamically. So where does the source of this text begin? I guess it should be similar to the "user" from the rich text editor to write and pass it to the back end. When passing it, it should have its own label.

otherwise, if you write dead text, you can write it yourself at the front end, and you don't need to get it through the back end.
what do you think?!

ps: some people say that it is obviously unreasonable to make the backend list,. Can you answer from the source of the question?


turn it into an array according to the semicolon; then loop the array and fill it into tags such as data return to define an arr
let list='1.. How are you; 2. Who are you; 3. You can
this.arr=list.split (';')
< span v-for='item of arr' > {{item}}
, you can


let the backend return a list, and then the frontend traverses, with the p tag, you can


if the format is fixed, the front end can follow each sentence. Split into arrays, and then traverse


either add
when the backend returns to you, or divide it into list, your own loop


A whole string wrapping is uncontrollable and can not achieve the desired effect. As the above two bigwigs said, it must first be converted into an array in js:

.
jobsdetail,jobsdetail
....
this.jobsdetail=dataA
this.jobsdetail.PostDutiesArr=dataA.PostDuties.replace(/\s\d/g,v=>{return '$'+v}).split('$ ')
.....


....
<p v-for='it in item.PostDutiesArr'>{{it}}

....

this kind of thing obviously should be formatted and returned by the back end for you, and it is impossible to format it at the front end.
the logic that can be handled at the back end should not be left to the front end as far as possible, because the front end is too easy to be tampered with.


divide the business requirements by the; sign,

if the backend is allowed to give, the estimated format is like this


textrea

    textareaTo(str) {
        let regs = new RegExp("\r", "g");
        let reg = new RegExp("\n", "g");
        let regSpace = new RegExp(" ", "g");
        str = str.replace(reg, "<br/>");
        str = str.replace(regs, "<br/>");
        str = str.replace(regSpace, "");
        return str;
    },
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e90ce6-130a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e90ce6-130a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?