2016-12-28 51 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

不知道我有多少次可能忽視它。謝謝。 –