版权声明:本人原创文章,转载时请保留所有权并以超链接形式标明文章出处 https://blog.csdn.net/qq_37138818/article/details/84535847
如果不设置js的值
那么编辑时页面会出现 可能是 null 或者undefined
var swd_id = $(t).attr("id-data"); //商品id
SWD_ID = swd_id;
var a_price = $(t).attr("aprice-data"); //渠道价
var c_price = $(t).attr("cprice-data"); //修理厂价
var cost_price = $(t).attr("cost-data"); //修理厂价
var w_name = $(t).attr("wname-data"); //商品名称
var oe = $(t).attr("oe-data"); //oe
var description = $(t).attr("description-data"); //车型备注
var mcode = $(t).attr("mcode-data"); //mcode 助记码
var rem = $(t).attr("rem-data"); //备注
if(oe == "" || oe=== "undefined" || oe === "null"){
var oe="";
}
if(description == "" || description === "undefined" || description === "null"){
var description="";
}
if(rem == "" || rem=== "undefined" || rem === "null"){
var rem ="";
}
if(mcode == "" || mcode=== "undefined" || mcode === "null"){
var mcode="";
}
$("#costprice").val(cost_price);
$("#aprice").val(a_price);
$("#cprice").val(c_price);
$("#wname").val(w_name);
$("#oe").val(oe);
$("#description").val(description);
$("#rem").val(rem);
$("#mcode").val(mcode);
当时 oe== undefined || oe == null 就一直出现页面的null 或者是undefined
这里一定要使用 全等于 的