Answer the question
In order to leave comments, you need to log in
How to concatenate strings if the string contains a single quote?
vue.js has a template
id = "'" + obj[i].id + "'"
symbol = "'" + obj[i].symbol + "'"
name = '"' + obj[i].name + '"'
template += '<tr>'
template += '<td><a href="#" @click.prevent="addRow(' + id + ',' + symbol + ',' + name + ')">Add to Row</a></td>'
template += '</tr>'
BlaBla's bar")">Add to Row
Answer the question
In order to leave comments, you need to log in
var kav = "'"
params = [obj[i].id, obj[i].symbol, obj[i].name].map(
v => kav + ('' + v).replace(kav, "\\'") + kav
)
template += '<td><a href="#" @click.prevent="addRow('
+ params + ')">Add to Row</a></td>'
https://learn.javascript.ru/string
If you are too lazy to set up the environment to use single-file components , switch to X-Templates
In general, judging by how the template text is formed, you somehow did not understand why vue is needed at all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question