js中的传参

https://img4.mukewang.com/5c7f32f400013c1116090169.jpg

小弟想做的是。 将 row 的值传到 a 标签的 onclick 方法中。(row 是个json对象)

慕妹3242003
浏览 750回答 2
2回答

守候你守候我

本地服务器测试成功&nbsp; &nbsp; function actionFormatter(value, row, index) {&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; return [&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; '<a class="like" href="javascript:void(0)" data-toggle="tooltip" title="Like"><i class="glyphicon glyphicon-heart"></i></a> ',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; '<a&nbsp; href="javascript:void(0)" data-toggle="tooltip"&nbsp; data-trigger="hover" data-title="编辑用户" onclick="updateAction(this,'+JSON.stringify(row).replace(/['"]/g,'\'')+')">1<i class="glyphicon glyphicon-edit"></i></a> ',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; '<a&nbsp; href="javascript:void(0)" data-toggle="tooltip"&nbsp; data-trigger="hover" data-title="删除用户" onclick="deleteAction(this)">2<i class="glyphicon glyphicon-remove"></i></a> ',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; '<a&nbsp; href="javascript:void(0)" data-toggle="tooltip"&nbsp; data-trigger="hover" data-title="角色修改" onclick="roleSet(this)">3<i class="glyphicon glyphicon-user"></i></a> ',&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; '<a&nbsp; href="javascript:void(0)" data-toggle="tooltip"&nbsp; data-trigger="hover" data-title="角色删除" onclick="roleDel(this)">4<i class="glyphicon glyphicon-minus-sign"></i></a> ',&nbsp; &nbsp; &nbsp; &nbsp; ].join('');&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; }

凤凰求蛊

看样子应该用的bootstrap table,这个问题我也遇见了,暂时解决办法是请求数据成功后把数据存到变量中,然后传过去index来获取这行数据。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript