GameClubButton wx.createGameClubButton(Object object)

基础库 2.0.3 开始支持,低版本需做兼容处理。

创建游戏圈按钮。游戏圈按钮被点击后会跳转到小游戏的游戏圈。更多关于游戏圈的信息见 游戏圈使用指南

参数

Object object

属性 类型 默认值 必填 说明
type string 是 按钮的类型
text string 否 按钮上的文本,仅当 type 为 text 时有效
image string 否 按钮的背景图片,仅当 type 为 image 时有效
style Object 是 按钮的样式
icon string 是 游戏圈按钮的图标,仅当 object.type 参数为 image 时有效。

type 的合法值

值 说明 最低版本
text 可以设置背景色和文本的按钮
image 只能设置背景贴图的按钮,背景贴图会直接拉伸到按钮的宽高

style 的结构

属性 类型 默认值 必填 说明
left number 是 左上角横坐标
top number 是 左上角纵坐标
width number 是 宽度
height number 是 高度
backgroundColor string 是 背景颜色
borderColor string 是 边框颜色
borderWidth number 是 边框宽度
borderRadius number 是 边框圆角
textAlign string 是 文本的水平居中方式
fontSize number 是 字号
lineHeight number 是 文本的行高

style.textAlign 的合法值

值 说明 最低版本
left 居左
center 居中
right 居右

object.icon 的合法值

值 说明 最低版本
green 绿色的图标
white 白色的图标
dark 有黑色圆角背景的白色图标
light 有白色圆角背景的绿色图标

返回值

GameClubButton

示例代码

const button = wx.createGameClubButton({
  icon: 'green',
  style: {
    left: 10,
    top: 76,
    width: 40,
    height: 40
  }
})

个结果 ""

    没有找到相关内容 ""