当我刷新或重新加载页面并增加目标值时,它将重置存储在Firebase上的计数器。 id,该值始终会更新并显示给用户。
var countEl = document.getElementById("murphGoalCount");
function murphplus() {
murphGoalCount++;
mpoints.value ++
countEl.value = murphGoalCount;
database.ref().set({
murphScoredGoal: murphGoalCount,
murphPoints: mpoints.value
});
}