【发布时间】:2016-08-28 23:22:15
【问题描述】:
我跟踪了Getting started with firebase on the web中的每个流程 视频教程。这是我看完教程后写的代码。
<h1 id="one"></h1>
<script src="https://www.gstatic.com/firebasejs/3.3.0/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyCMhmAMbUwmZLQFG9EZLgnbmOJVabdfNvU",
authDomain: "test-24e84.firebaseapp.com",
databaseURL: "https://test-24e84.firebaseio.com",
storageBucket: "test-24e84.appspot.com",
};
firebase.initializeApp(config);
var one = document.getElementsById('one');
var dbref = firebase.database().ref().child('text');
dbref.on('value', snap => one.innerText = snap.val());
</script>
编写代码后,我在我的 chrome 浏览器中执行了 html 文件。但是,我在屏幕上看不到任何文字。(它只是空白,没有区别)
怎么了?我怎样才能让代码运行?
【问题讨论】:
标签: javascript firebase firebase-realtime-database