code:
<tr>
<td>Total</td>
<td>
<span class="lang-chang-label">$</span>
<span id="total" value="">{{ $price->night + $price->additional_guest + $price->security + $price->cleaning + $price->pet_fee + $price->pool_fee + $price->admin_fee + $price->tax}}</span>
</td>
<input type="hidden" id="total_amo" value="{{ $price->night + $price->additional_guest + $price->security + $price->cleaning + $price->pet_fee + $price->pool_fee + $price->admin_fee + $price->tax}}">
</tr>
在此代码中,我只是在做所有值的总和,但是在我的Price
api中,我已经tax=""
这就是我遇到此错误的原因。那么,我该如何解决这个问题呢?请帮助我。
谢谢
您遇到的错误是由于字符串和数值添加。因此,您可以获取空税的整数值并像这样添加:
<tr>
<td>Total</td>
<td>
<span class="lang-chang-label">$</span>
<span id="total" value="">{{ $price->night + $price->additional_guest + $price->security + $price->cleaning + $price->pet_fee + $price->pool_fee + $price->admin_fee + (int)$price->tax}}</span>
</td>
<input type="hidden" id="total_amo" value="{{ $price->night + $price->additional_guest + $price->security + $price->cleaning + $price->pet_fee + $price->pool_fee + $price->admin_fee + (int)$price->tax}}">
</tr>
希望你能理解。如有任何问题,请随时询问。