封鎖 >utils >樣式 >getComputedStyle

utils.style.getComputedStyle() 函式

擷取節點的運算樣式值。如果所要求的屬性是 SVG 檔案,而且尚未明確設定 (Firefox 和 webkit),系統就會傳回空白字串。

從 Closure 的 goog.style.getComputedStyle 複製

Signature:

export declare function getComputedStyle(element: Element, property: string): string;

參數

參數 類型 說明
元素 元素 要取得樣式的元素。
屬性 字串 要取得的房源 (駝峰式大小寫)。

傳回:

字串

樣式值。