<script>
$(function(){
var ws_scheme = window.location.protocol == "https:" ? "wss": "ws";
var ws_path = ws_scheme + "://" + window.location.host + "/dashboard";
console.log("Connecting to " + ws_path);
var socket = new ReconnectingWebSocket(ws_path);
socket.onmessage = function (message) {
// Decode the JSON
console.log("Got websocket message " + message.data);
var display = '<div class="uk-alert uk-alert-success">'+ message.data + "</div>";
console.log("Got websocket message " + display);
UIkit.notify({
message : display,
status : 'info',
timeout : 0,
pos : 'top-center'
});
}
});
</script>
对于以下代码片段,UI 工具包通知在屏幕的左下角显示通知。如果我可以将位置设置为其他可能的值,它不会改变。
我一定是在做一些非常愚蠢的事情。任何帮助表示赞赏。