已经导入了script标签 但是不能new 出来WildDog()方法是怎么回事,要传送过去的数据也没有收到?
<body>
<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">聊天窗口</h1>
</header>
<div class="mui-content">
<div class="msg-box">
<p><h5 id="nickname_lable"></h5></p>
<input type="hidden" name="nickname" id="nickname" value=""/>
<p><h5 id="room_lable"></h5></p>
<input type="hidden" name="room" id="room" value=""/>
</div>
<div class="msg-list" id='msg-list'>
</div>
</div>
<footer>
<div class="footer-center">
<textarea id='msg-text' type="text" class="input-text"></textarea>
</div>
<label for="" class="footer-right">
<button type="button" class="mui-btn mui-btn-blue" id="send">发送</button>
</label>
</footer>
<script src="js/mui.min.js"></script>
<script>
mui.init();
mui.plusReady(function(){
//从本地获取数据
var nickname=document.getElementById("nickname");
var nickname_lable=document.getElementById("nickname_lable");
var room=document.getElementById("room");
var room_lable=document.getElementById("room_lable");
localStorage.nickname=nickname.value;
localStorage.room=room.value;
nickname_lable.innerHTML="您好"+localStorage.nickname;
room_lable.innerHTML="当前房间号"+localStorage.room;
//实现聊天功能
var msg_text=document.getElementById("msg-text");
var msg_list=document.getElementById("msg-list");
var send=document.getElementById("send");
//var data=new Wilddog('https://.......wilddogio.com/chatmess');
var data=new
send.addEventListener('tap',function(){
var myDate=new Date();
var mytime=myDate.getTime();
var room_value=room.value;
var nickname_value=nickname.value;
var msg_text_value=msg_text.value;
data.child(room_value).child(mytime).set({
"name":nickname_value,"content":msg_text_value,"time":mytime});
})
})
</script>
</body>
2 个回复
诺墨同学 - 诺墨的小号,仅此一个 主号 @诺墨
你好,你可以重新看看这个教程。
http://edu.yuantuan.com/course/112
3***@qq.com
我也是用的野狗,在摸拟器里开发的APP可以实现数据的添加,打包成APP后,在实机上就不行,有知道为什么 吗、