+ doesn't work in JavaScript.

you need to jump to a url
after clicking on the event, and then url uses the thinkphp output

.
location.href = "{:addonUrl("unionMember/User/edit", ["id" => "+data.id+"])}"

where data.id can display
correctly through alert (), but output as is between PP

/app/unionMember/User/edit/id/%2Bdata.id%2B/mid/2

excuse me, why is this?

if you try to write like this, you will also output as is:

location.href = "/app/unionMember/User/edit/id/"+data.id+"/mid/2";

also replied in the comments below,
through
var id = data.id;
and then

location.href = "{:addonUrl("unionMember/User/edit", ["id" => "+id+"])}"

can output normally, very strange this question, also very grateful to the friends downstairs for their help.

but I would like to ask, where did that idiot in the comments downstairs come from, eating Xiang every day?

clipboard.png

now that I have asked a question, I must have encountered a problem. If I can explain why it appears, why should I ask a question?

True Nima, it takes 15 more prestige to report. I wish the community to develop and grow. If there are any questions in the future, I dare not come here to ask questions again.

Feb.16,2022

did not happen what you said. demo

Menu