Java Script 學習

此文章主要是在撰寫Web網頁時,使用Java Script及Kendo UI的學習心得。


Ajax 在IE上查詢失敗

Ajax 在Chrome, Edge都可以正常執行,但在IE上卻失敗。

原因是ajax在Chrome, Edge對於中文字會自動轉換編碼,但是在IE並不會自動轉換而形成亂碼。

解決方式:


Hexo Icarus 修改歷程

Blog 客製化

更改背景色

更改$body-background-color

~\themes\icarus\include\style\base.styl
1
$body-background-color ?= $blue

參數路徑:

~\node_modules\bulma-stylus\stylus\utilities\initial-variables.styl
1
2
3
4
5
6
$orange ?=       hsl(16,  100%, 50%)
$yellow ?= hsl(48, 100%, 67%)
$green ?= hsl(141, 53%, 53%)
$turquoise ?= hsl(171, 100%, 41%)
$cyan ?= hsl(204, 71%, 53%)
$blue ?= hsl(219, 97%, 14%)

Escaping 跳脫符號

範例中,使用兩層的closure,將closure作為callback function,當完成事件時,需要透過callback function將執行結果傳遞至畫面上呈現.

使用時遇到了以下的錯誤訊息.
“Escaping closure captures non-escaping parmeter”


Alamofire SessionDeinitialized & TLS Trust

在使用Alamofire library進行Https連接時,遇到了default TLS Trust evaluation failed 這個錯誤.

基本上看起來是無法取得憑證所導致的錯誤,但網站端所請求的並不是合法的憑證.

因此我們必須先透過ServerTrustManager來繞過憑證的驗證.


Can't find type xxx in scope

在程式中,常常會愈遇到 Can’t find type ‘XXX’ in scope 的錯誤,發生原因通常是

  • 拼字錯誤或大小寫不一致
  • 型態宣告不對
  • 未加入complie source中