Integration Binance fiat widget with your web application
install
npm install binance-fiat-widget
used
<div id="widget"></div>
import { Widget } from "binance-fiat-widget";
const options = {
locale: "en",
width: 200,
theme: "dark",
urlParmas: {
ref: "",
utm_source: "",
},
};
Widget("#widget", options);
Parameters
-
el:
selector
orDOM element
react
import { Widget, unloadWidget } from "binance-fiat-widget";
const app = () => {
const t = useRef < HTMLDivElement > null;
// or
// const t = document.querySelector('#test')
useEffect(() => {
if (t) {
Widget(t);
}
return () => unloadWidget();
}, []);
return <div id="#test" ref={r}></div>;
};cdn
<script src="https://bin.bnbstatic.com/static/js/ocbs/binance-fiat-widget.js"></script>
<div id="widget"></div>const t = document.querySelector("#test");
window.binanceFiatWidget.Widget(t); -
options.locale:
string
i18n
,nullable
, default: 'en'opts:
'en'|'cn'|'tw'|'kr'|'ru'|'vn'|'it'|'es'|'de'|'fr'
-
options.width:
number
width
,nullable
, default: 200range:
200
-500
-
options.theme:
string
theme
,nullable
, default: 'light'opts:
'light' | 'dark'
-
options.urlParmas
-
options.urlParmas.ref:
string
ref id
,nullable
-
options.urlParmas.utm_source:
string
UTM source
,nullable
-
-
options.api_host:
string
overlay
getCoinListApi
,nullable