数字必须居中对齐,文字必须保持对齐
我的代码中出现错误。谁能告诉我我做错了什么
图像
代码
color = color !== "" && color !== undefined ? " <span class=\"color\" style=\"background: #" + color + "\"></span>" : " <span class=\"color\"></span>";
contentHtml += "<td rowspan1=\"" + 1 + "\" class=\"" + (rowspan !== "" && rowspan > 1 ? "groups" : "") + " " + (typeof value == Number) ? "text-center" : "text-left" + "\">" + value + (Number(value) ? preFix : "") + color + (Number(value) ? postFix : "") + "</td>";
if (rowspan > 1) {
var rowspanContent = "<td rowspan1=\"" + rowspan + "\" class=\"" + (rowspan !== "" && rowspan > 1 ? "groups" : "") + " " + (typeof value == Number) ? "text-center" : "text-left" + "\">" + value + (Number(value) ? preFix : "") + color + (Number(value) ? postFix : "") + "</td>"; }
&#13;
答案 0 :(得分:0)
将三元语句(typeof value == Number) ? "text-center" : "text-left"
括在方括号中,以便在使用的两种情况下都具有... + ((typeof value == Number) ? "text-center" : "text-left") + ...