抖音开放平台Logo
控制台

FollowButton.hide
收藏
我的收藏

基础库 1.19.0 开始支持本方法,低版本需做兼容处理。 暂时只支持在今日头条 App 上使用。

隐藏关注按钮,调用 FollowButton.show 可重新显示关注按钮。

语法

FollowButton.hide()

参数说明

代码示例

预期表现:2s 后隐藏关注按钮。

const followButton = tt.createFollowButton({
  type: "image",
  image: "images/follow-button.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",
  },
});

function onTap(res) {
  const { buttonId, errCode, errMsg } = res;
  tt.showModal({
    title: "关注",
    content: `关注按钮id:${buttonId}, errCode: ${errCode}, 详细信息:${errMsg}`,
  });
}

setTimeout(() => followButton.hide(), 2000);

Bug & Tip

暂无。

文档评论

登录后可参与评论