let data = {a:10,b:20}
let obj = JSON.stringify(data).replace(/\"/g,"'")
`<div onclick="navClick(${obj})"></div>`
function navClick(obj) {
let {a,b} = obj;
}
let data = {a:10,b:20}
let obj = JSON.stringify(data).replace(/\"/g,"'")
`<div onclick="navClick(${obj})"></div>`
function navClick(obj) {
let {a,b} = obj;
}
本文标题:字符串模板click传JSON数据
本文链接:https://www.haomeiwen.com/subject/yuyyrktx.html
网友评论