企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# wx.createFeedbackButton ### FeedbackButton wx.createFeedbackButton(string type, string text, string image, Object style) > 支持版本 >= 2.1.2 创建打开意见反馈页面的按钮 #### 参数 ##### string type 按钮的类型 **type 的合法值** 值说明text可以设置背景色和文本的按钮image只能设置背景贴图的按钮,背景贴图会直接拉伸到按钮的宽高##### string text 按钮上的文本,仅当 type 为 `text` 时有效 ##### string image 按钮的背景图片,仅当 type 为 `image` 时有效 ##### Object style 按钮的样式 属性类型默认值是否必填说明支持版本leftnumber是左上角横坐标topnumber是左上角纵坐标widthnumber是宽度heightnumber是高度backgroundColorstring是背景颜色borderColorstring是边框颜色borderWidthnumber是边框宽度borderRadiusnumber是边框圆角textAlignstring是文本的水平居中方式fontSizenumber是字号lineHeightnumber是文本的行高**style.textAlign 的合法值** 值说明left居左center居中right居右#### 返回值 ##### FeedbackButton #### 示例代码 ``` <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">createFeedbackButton</span><span class="pun">({</span></code></li> <li class="l1"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> type</span><span class="pun">:</span><span class="pln"> </span><span class="str">'text'</span><span class="pun">,</span></code></li> <li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> text</span><span class="pun">:</span><span class="pln"> </span><span class="str">'打开意见反馈页面'</span><span class="pun">,</span></code></li> <li class="l1"><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="l"><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="l1"><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="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">200</span><span class="pun">,</span></code></li> <li class="l1"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> height</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"> lineHeight</span><span class="pun">:</span><span class="pln"> </span><span class="lit">40</span><span class="pun">,</span></code></li> <li class="l1"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> backgroundColor</span><span class="pun">:</span><span class="pln"> </span><span class="str">'#ff0000'</span><span class="pun">,</span></code></li> <li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> color</span><span class="pun">:</span><span class="pln"> </span><span class="str">'#ffffff'</span><span class="pun">,</span></code></li> <li class="l1"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> textAlign</span><span class="pun">:</span><span class="pln"> </span><span class="str">'center'</span><span class="pun">,</span></code></li> <li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> fontSize</span><span class="pun">:</span><span class="pln"> </span><span class="lit">16</span><span class="pun">,</span></code></li> <li class="l1"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> borderRadius</span><span class="pun">:</span><span class="pln"> </span><span class="lit">4</span></code></li> <li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> </span><span class="pun">}</span></code></li> <li class="l1"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pun">})</span></code></li> </ol> ``` > 原文: <https://developers.weixin.qq.com/minigame/dev/api/open-api/feedback/wx.createFeedbackButton.html>