Skip to content

pantoken-root / packages/core/src / decodeIconSvg

函式: decodeIconSvg() ​

decodeIconSvg(value): string

Beta(測試)

將圖示代幣的 url('data:…') 值解碼回內嵌 SVG。

參數 ​

value ​

string

回傳 ​

string

範例 ​

ts
import { decodeIconSvg } from "@pantoken/core";

const svg = "<svg viewBox='0 0 24 24'><path d='M1 1'/></svg>";
const value = `url('data:image/svg+xml;utf8,${encodeURIComponent(svg)}')`;
decodeIconSvg(value); // → "<svg viewBox='0 0 24 24'><path d='M1 1'/></svg>"