2016-12-28 50 views
0
<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工具包notify将在屏幕左下角显示通知。 它不会改变,如果我可以到其他位置possible values.UI工具包通知pos问题

我必须做一些非常愚蠢的事情。任何帮助表示赞赏。

回答

1

uikit内部的消息notify只是字符串,也许在里面使用div会损坏剩下的部分,尽量让它变成小提琴。

另外通知组件有它自己的css,一定要包含它。

+0

不知道我有多少次可能忽视它。谢谢。 –