我知道如何在js中包含一个条件。就像你在我的表中看到的那样,这个常数为MODE_B2B_B2C; 如何在js中做同样的事情。
Tk的。
<table width="100%" cellpadding="5" cellspacing="0" border="0">
<tr>
if (MODE_B2B_B2C == 'true') {
$content .= '
<td>' . $this->app->getDef('table_heading_customers_group') . '</td>
';
}
</tr>
</table>
$output = <<<EOD
<script type="text/javascript"><!--
var quantitydiscount_row = $i;
function addQuantityDiscountValue() {
//customers_group_id
html += '<td>';
html += ' <select name="products_quantitydiscount[' + quantitydiscount_row + '][customers_group_id]" class="form-control">{$customers_group_name}</select>';
html += '</td>';
quantitydiscount_row++;
}
</script>
<br />
EOD;
答案 0 :(得分:0)
您可以使用模板字符串:
let myVal = 123;
function condition(input) {
if (input > 10) return "foo";
return "bar";
}
let str = `This will output ${myVal} * 2 = ${myVal * 2}.
Condition: ${condition(2)}
Condition: ${condition(20)}
`;
console.log(str);