W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
基礎(chǔ)庫(kù) 1.19.0 開始支持本方法,低版本需做兼容處理。
暫時(shí)只支持在今日頭條 App 上使用(使用說(shuō)明)。
創(chuàng)建關(guān)注頭條號(hào)按鈕。
Object 類型,屬性如下:
屬性 | 類型 | 默認(rèn)值 | 必填 | 描述 |
---|---|---|---|---|
type | string | 是 | 按鈕的類型,取值 image 或 text。image 對(duì)應(yīng)圖片按鈕,text 對(duì)應(yīng)文本按鈕 | |
image | string | 否 | 按鈕的背景圖片,type 為 image 時(shí)必填。僅支持本地圖片,目錄包括代碼包目錄、臨時(shí)文件目錄和本地用戶目錄 | |
style | object | 是 | 按鈕的樣式 |
屬性 | 類型 | 默認(rèn)值 | 必填 | 說(shuō)明 |
---|---|---|---|---|
left | number | 是 | 左上角橫坐標(biāo) | |
top | number | 是 | 左上角縱坐標(biāo) | |
width | number | 是 | 寬度 | |
height | number | 是 | 高度 | |
backgroundColor | string | 是 | 背景顏色 | |
borderColor | string | 是 | 邊框顏色 | |
borderWidth | number | 是 | 邊框?qū)挾?/td> | |
borderRadius | number | 是 | 邊框圓角 | |
textAlign | string | 是 | 文本的水平居中方式 | |
fontSize | number | 是 | 字號(hào) | |
lineHeight | number | 是 | 文本的行高 | |
textColor | string | 是 | 文本顏色 |
值 | 說(shuō)明 |
---|---|
left | 居左 |
center | 居中 |
right | 居右 |
返回一個(gè) FollowButton 對(duì)象
// 創(chuàng)建關(guān)注頭條號(hào)按鈕
const btn = tt.createFollowButton({
type: "image",
image: "images/follow_btn.png",
style: {
left: 20,
top: 40,
width: 150,
height: 40,
lineHeight: 40,
backgroundColor: "#ff0000",
textColor: "#ffffff",
textAlign: "center",
fontSize: 16,
borderRadius: 4,
borderWidth: 1,
borderColor: "#ff0000"
}
});
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: