使用此代碼,我可以將數(shù)據(jù)庫(kù)添加到 firebase,但在我的經(jīng)度和緯度中使用引號(hào)我想在我的經(jīng)度和緯度中不帶引號(hào)的情況下將數(shù)據(jù)庫(kù)添加到 firebase 這樣我的地圖將讀取經(jīng)度緯度而無(wú)需手動(dòng)刪除firebase中的引號(hào)謝謝.....var dbRef= firebase.database().ref('/users /' + userId.value);var bounds = new google.maps.LatLngBounds();dbRef.on('value', function(snapshot) {snapshot.forEach(function(child) {var data=child.val();console.log(data);var marker = new google.maps.Marker({ position: { lat: data.lat, lng: data.lng }, map: map});bounds.extend(marker.getPosition());marker.addListener('click', (function(data) { return function(e) { infowindow.setContent( data.first_name + "<br>" + data.last_name + "<br>" + data.age + " <br>" + data.symptom + "<br>" + this.getPosition().toUrlValue(6) ); infowindow.open(map, this); }}(data)));map.fitBounds(bounds); });});}google.maps.event.addDomListener(window, "load", initialize);const database = firebase.database();addBtn.addEventListener('click' , (e) => { e.preventDefault(); database.ref('/users /' + userId.value).set({ first_name: firstName.value, last_name: lastName.value, age: age.value, symptom: symptom.value, lat: lat.value, lng: lng.value, });});
如何將不帶引號(hào)的數(shù)據(jù)從我的網(wǎng)站添加到 firebase
明月笑刀無(wú)情
2022-12-29 15:30:16