在HTML中 在JS 中进行动态编辑标签,拼接函数传参时,往往涉及到多个参数,这是可能会造成参数传递异常
代码形式如下:(拼接时函数名不要加引号,参数加引号)
function(value, row, index) {
actions.push('<a onclick= editDevice("'+row.id+'","'+row.deviceTypeId+'")><i class="fa fa-edit"></i>编辑</a> ');
return actions.join('');
}
//函数
function editDevice(id,deviceTypeId){
console.log(id)
console.log(deviceTypeId)
}
参考文章:https://blog.youkuaiyun.com/weixin_38238552/article/details/106919535