@ binance/ fiat-widget (英语)
-
你没有被列入任何贸易或经济制裁清单,例如联合国安全理事会制裁清单,被外国资产管制处(美国财政部外国资产管制处)指定为 " 特别指定国民 " ,或被列入美国商务部的 " 杰出人员名单 " .
-
您不提供任何可能构成非法、非法活动的受限/被禁业务
安装 根据 HTML CODE 在五分钟内
-
你可以从你的Binance.com ref id那里得到 Binance 转诊程序- 还有比南斯 美国参考自 Binance.US 转诊方案
-
添加下面的代码并输入您的 ref id 1),如果同时拥有Binance.com和Binance. US ref id, 请在“ ref” 和“ us ref” 栏下输入您的 ref id 2, 如果您只有 Binance.com ref id, 请在“ ref” 下输入您的 ref id, 删除“ us ref” 部分
<script src="https://public.bnbstatic.com/static/js/ocbs/@binance/fiat-widget.js"></script>
<div id="widget"></div>
<script>
window.onload = function () {
var t = document.querySelector('#widget')
window.binanceFiatWidget.Widget(t, {
locale: 'en',
coinInfo: {
fiat: '',
crypto: '',
isInUS: false
},
urlParmas: {
us_ref: 'your us refId',
ref: 'your refId'
}
})
}
</script>
finally,检查跳动链接有参数 ref,像这样: https://www.binance.com/cn/buy-sell-crypto?fiat=USD&crypto=BTC&amount=1000&ref=xxxxxx
安装
npm install @binance/fiat-widget
// or cdn
<script src="https://public.bnbstatic.com/static/js/ocbs/@binance/fiat-widget.js"></script>
使用过的
<div id="widget"></div>
import {Widget} from '@binance/fiat-widget'
const options = {
locale: 'en',
width: 200,
theme: 'dark',
coinInfo: {
fiat: '',
crypto: '',
isInUS: false
},
urlParmas: {
ref: '',
us_ref: '',
utm_source: ''
}
}
Widget('#widget', options)
- 反应
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>)
}
参数
-
埃尔:
selector或者说DOM element -
选项。本地化 :
stringi18n, (中文(简体) ),nullable,默认值:“en”选择 :
'cn','de','en','es','fr','id','it','kr','nl','pl','pt','ru','tr','tw','ua','vn',,不支持的语境会倒向英语 -
选项.width :
numberwidth, (中文(简体) ),nullable, (中文(简体) ),如果不设定宽度, 默认值为 el. offsetWidth
范围 :
200- 说吧500 -
选项。 主题:
stringtheme, (中文(简体) ),nullable,默认值:“光”选择 :
'light' | 'dark' -
选项.urlPharmas
-
选项.urlPharmas.ref:
stringref id, (中文(简体) ),nullable -
选项.urlPharmas.us ref:
string输入您的参考文献 1 。 如果你同时拥有Binance.com和Binance的话. US ref id, 请分别在"ref"和"us ref"两节下输入您的 ref id 。 如果您只有 Binance.com ref id, 请在“ ref” 下输入您的 ref id, 删除“ us ref” 部分
us_ref id, (中文(简体) ),nullable -
选项.urlPharmas.utm source:
stringUTM source, (中文(简体) ),nullable
-
-
选项.coinInfo
-
选项.coinInfo.fiat:
stringfiat name, (中文(简体) ),nullable -
选项.coinfo.crypto:
stringcrypto name, (中文(简体) ),nullable -
选项.coinInfo.isInUS:
string对于美国Widget Partners(例如,网站流量的50%是在美国),请输入真实信息。 对美国居民来说, 对于国际部件伙伴,请输入虚假.
选择 :
true | false
-
-
选项. api host:
string覆盖
getCoinListApi, (中文(简体) ),nullable -
选项.us api host:
string覆盖
getUsCoinListApi, (中文(简体) ),nullable -
选项。skeletonScreen :
booleannullable默认值true,显示占位符部件
API 密码
-
设置 XXX
setXXX是更改部件字符的函数, 您可以使用它chaining喜欢jquery,则需要使用render来完成它
const w = widget(container, opt)
w.setTheme('dark').setLocale('cn').render()
- setTheme
change the theme
const w = widget(container, opt)
w.setTheme('dark').render()
- setLocale
change the locale
const w = widget(container, opt)
w.setLocale('cn').render()
-
提交
渲染部件( 在
.setXXX()有必要)
const w = widget(container, opt)
w.setTheme('dark').render()
render will fetch api, so `render` return a `Promise`
const w = widget(container, opt)
w.setTheme('dark').render().then(v => alert('has render'))
-
卸载部件
从页面中去掉部件, 也许你会在 React shocks 中使用它来替换
setXXX()
useEffect(() => {
if (t?.current) {
w = Widget(t.current, {
theme: theme
})
}
return () => unloadWidget()
}, [theme])