tt.createFollowButton

2020-02-15 02:10 更新
基礎(chǔ)庫(kù) 1.19.0 開始支持本方法,低版本需做兼容處理。
暫時(shí)只支持在今日頭條 App 上使用(使用說(shuō)明)。

創(chuàng)建關(guān)注頭條號(hào)按鈕。


參數(shù)

Object 類型,屬性如下:

屬性類型默認(rèn)值必填描述
typestring按鈕的類型,取值 image 或 text。image 對(duì)應(yīng)圖片按鈕,text 對(duì)應(yīng)文本按鈕
imagestring按鈕的背景圖片,type 為 image 時(shí)必填。僅支持本地圖片,目錄包括代碼包目錄、臨時(shí)文件目錄和本地用戶目錄
styleobject按鈕的樣式

style 對(duì)象說(shuō)明

屬性類型默認(rèn)值必填說(shuō)明
leftnumber左上角橫坐標(biāo)
topnumber左上角縱坐標(biāo)
widthnumber寬度
heightnumber高度
backgroundColorstring背景顏色
borderColorstring邊框顏色
borderWidthnumber邊框?qū)挾?/td>
borderRadiusnumber邊框圓角
textAlignstring文本的水平居中方式
fontSizenumber字號(hào)
lineHeightnumber文本的行高
textColorstring文本顏色

style.textAlign 屬性合法值

說(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"
  }
});


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)