-1
我有從一個api中讀取的lat lng座標,所以我可以將它們放在一個跨度中。我遇到的問題是,座標是通過api輸入的任何值,然後我將它們輸出到頁面上。將數字舍入到小數位
<div id="co-ordinates">
<strong>Coordinates</strong>
<span class="lat"><%= @camera.deep_fetch(:location, :lat) {} %></span>
<span class="lng"><%= @camera.deep_fetch(:location, :lng) {} %></span>
</div>
有沒有辦法那麼我可以使用JavaScript來的座標值的小數位數限制爲6位?
'13.37.toFixed(6)' – A1rPun 2014-10-30 14:18:42
<%= - 是服務器端腳本標記,將它們放在服務器端代碼中 – Igor 2014-10-30 14:20:44