# follow-service

一键关注服务号组件

# 属性

属性 类型 默认值 必填 说明
followed-id string 指定 id,若不提供或校验不通过(一切拉取服务号信息的失败情况),则不显示该组件
desc string '关注我,及时获取更多动态信息' 描述文案
theme 'normal' | 'thin' 'normal' 卡片排版主题
background-color 'white' | 'gray' 'white' 组件背景色主题
show-close-button boolean true 是否显示右侧关闭按钮
binderror (e: { detail: { errMsg: string } } & Event) => void 拉取服务号信息失败时的回调(此时不显示组件)
bindfollow (e: { detail: { errMsg: string } } & Event) => void 点击添加关注回调
bindopenprofile (e: { detail: { errMsg: string } } & Event) => void 跳转服务号主页回调

# 使用示例

<follow-service
    followed-id="xxxxxx"
    desc="关注我,了解特效师的工作日常"
></follow-service>

注:

  1. followed-id 必填,否则将无法获取账号信息,导致无法渲染组件
  2. 组件最小宽度为 184px,高度固定:theme="normal"时为 68px,theme="thin"时为 52px
  3. theme="thin" 时,将不显示关闭按钮
  4. 该组件与基础库 1.42.0 版本后支持,若需要做向前兼容处理,可通过 ks.canIUse('follow') 判断当前版本是否支持使用该组件
Copyright ©2024, All Rights Reserved