javascript:将增量值存储在firebase上并向用户显示更新的值

时间:2019-10-15 00:47:00

标签: javascript firebase firebase-realtime-database

当我刷新或重新加载页面并增加目标值时,它将重置存储在Firebase上的计数器。 id,该值始终会更新并显示给用户。

var countEl = document.getElementById("murphGoalCount");

function murphplus() {
  murphGoalCount++;
    mpoints.value ++
  countEl.value = murphGoalCount;

  database.ref().set({
        murphScoredGoal: murphGoalCount,
        murphPoints: mpoints.value
      });


}

0 个答案:

没有答案