企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# wx.createGameClubButton ### GameClubButton wx.createGameClubButton(Object object) > 支持版本 >= 2.0.3 创建游戏圈按钮。游戏圈按钮被点击后会跳转到小游戏的游戏圈。更多关于游戏圈的信息见 [游戏圈使用指南](https://developers.weixin.qq.com/minigame/dev/tutorial/open-ability/game-club.html) #### 参数 ##### Object object 属性类型默认值是否必填说明支持版本typestring是按钮的类型textstring是按钮上的文本,仅当 type 为 `text` 时有效imagestring是按钮的背景图片,仅当 type 为 `image` 时有效styleObject是按钮的样式iconstring是游戏圈按钮的图标,仅当 object.type 参数为 image 时有效。**type 的合法值** 值说明text可以设置背景色和文本的按钮image只能设置背景贴图的按钮,背景贴图会直接拉伸到按钮的宽高**style 的结构** 属性类型默认值是否必填说明支持版本leftnumber是左上角横坐标topnumber是左上角纵坐标widthnumber是宽度heightnumber是高度backgroundColorstring是背景颜色borderColorstring是边框颜色borderWidthnumber是边框宽度borderRadiusnumber是边框圆角textAlignstring是文本的水平居中方式fontSizenumber是字号lineHeightnumber是文本的行高**style.textAlign 的合法值** 值说明left居左center居中right居右**object.icon 的合法值** 值说明green绿色的图标white白色的图标dark有黑色圆角背景的白色图标light有白色圆角背景的绿色图标#### 返回值 ##### GameClubButton #### 示例代码 ``` <pre class="prettyprint"><ol class="linenums"><li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln">let button </span><span class="pun">=</span><span class="pln"> wx</span><span class="pun">.</span><span class="pln">createGameClubButton</span><span class="pun">({</span></code></li> <li class="l1"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> icon</span><span class="pun">:</span><span class="pln"> </span><span class="str">'green'</span><span class="pun">,</span></code></li> <li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> style</span><span class="pun">:</span><span class="pln"> </span><span class="pun">{</span></code></li> <li class="l1"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> left</span><span class="pun">:</span><span class="pln"> </span><span class="lit">10</span><span class="pun">,</span></code></li> <li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> top</span><span class="pun">:</span><span class="pln"> </span><span class="lit">76</span><span class="pun">,</span></code></li> <li class="l1"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">40</span><span class="pun">,</span></code></li> <li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> height</span><span class="pun">:</span><span class="pln"> </span><span class="lit">40</span></code></li> <li class="l1"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> </span><span class="pun">}</span></code></li> <li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pun">})</span></code></li> </ol> ``` > 原文: <https://developers.weixin.qq.com/minigame/dev/api/open-api/game-club/wx.createGameClubButton.html>