# wx.createOpenSettingButton
### OpenSettingButton wx.createOpenSettingButton(string type, string text, string image, Object style)
> 支持版本 >= 2.0.7
创建打开设置页面的按钮
#### 参数
##### 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居右#### 返回值
##### OpenSettingButton
#### 示例代码
```
<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">createOpenSettingButton</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/setting/wx.createOpenSettingButton.html>
- 致谢
- 渲染
- 画布
- wx.createCanvas
- Canvas
- .toTempFilePath
- .toTempFilePathSync
- .getContext
- .toDataURL
- RenderingContext
- 图片
- wx.createImage
- Image
- 字体
- wx.getTextLineHeight
- wx.loadFont
- 帧率
- wx.setPreferredFramesPerSecond
- cancelAnimationFrame
- requestAnimationFrame
- 分包加载
- wx.loadSubpackage
- LoadSubpackageTask
- .onProgressUpdate
- 设备
- 设备方向
- wx.startDeviceMotionListening
- wx.stopDeviceMotionListening
- wx.onDeviceMotionChange
- 加速计
- wx.startAccelerometer
- wx.stopAccelerometer
- wx.onAccelerometerChange
- 剪贴板
- wx.getClipboardData
- wx.setClipboardData
- 罗盘
- wx.startCompass
- wx.stopCompass
- wx.onCompassChange
- 陀螺仪
- wx.startGyroscope
- wx.stopGyroscope
- wx.onGyroscopeChange
- 电量
- wx.getBatteryInfo
- wx.getBatteryInfoSync
- 网络
- wx.getNetworkType
- wx.onNetworkStatusChange
- 振动
- wx.vibrateShort
- wx.vibrateLong
- 性能
- wx.onMemoryWarning
- 屏幕
- wx.getScreenBrightness
- wx.setKeepScreenOn
- wx.setScreenBrightness
- 转屏
- wx.onDeviceOrientationChange
- wx.offDeviceOrientationChange
- 系统
- 系统信息
- wx.getSystemInfo
- wx.getSystemInfoSync
- 系统事件
- wx.onAudioInterruptionBegin
- wx.offAudioInterruptionBegin
- wx.onAudioInterruptionEnd
- wx.offAudioInterruptionEnd
- wx.onError
- wx.offError
- 生命周期
- wx.exitMiniProgram
- wx.getLaunchOptionsSync
- wx.onHide
- wx.offHide
- wx.onShow
- wx.offShow
- 触摸事件
- wx.onTouchStart
- wx.offTouchStart
- wx.onTouchMove
- wx.offTouchMove
- wx.onTouchEnd
- wx.offTouchEnd
- wx.onTouchCancel
- wx.offTouchCancel
- Touch
- 位置
- wx.getLocation
- 媒体
- 图片
- wx.chooseImage
- wx.previewImage
- wx.saveImageToPhotosAlbum
- 音频
- wx.createInnerAudioContext
- wx.getAvailableAudioSources
- wx.setInnerAudioOption
- InnerAudioContext
- .pause
- .stop
- .seek
- .destroy
- .offCanplay
- .onPlay
- .offPlay
- .onPause
- .offPause
- .onStop
- .offStop
- .onEnded
- .offEnded
- .onTimeUpdate
- .offTimeUpdate
- .onError
- .onCanplay
- .offError
- .onWaiting
- .offWaiting
- .onSeeking
- .offSeeking
- .onSeeked
- .offSeeked
- .play
- 录音
- wx.getRecorderManager
- RecorderManager
- .start
- .pause
- .resume
- .stop
- .onStart
- .onResume
- .onPause
- .onStop
- .onFrameRecorded
- .onError
- .onInterruptionBegin
- .onInterruptionEnd
- 视频
- wx.createVideo
- Video
- .onWaiting
- .offWaiting
- .onPlay
- .offPlay
- .onPause
- .offPause
- .onEnded
- .offEnded
- .onTimeUpdate
- .offTimeUpdate
- .onError
- .offError
- .destroy
- .play
- .pause
- .stop
- .seek
- .requestFullScreen
- .exitFullScreen
- 文件
- wx.getFileSystemManager
- FileSystemManager
- .access
- .accessSync
- .appendFile
- .appendFileSync
- .saveFile
- .saveFileSync
- .getSavedFileList
- .removeSavedFile
- .copyFile
- .copyFileSync
- .getFileInfo
- .mkdir
- .mkdirSync
- .readFile
- .readFileSync
- .readdir
- .readdirSync
- .rename
- .renameSync
- .rmdir
- .rmdirSync
- .stat
- .statSync
- .unlink
- .unlinkSync
- .unzip
- .writeFile
- .writeFileSync
- Stats
- .isDirectory
- .isFile
- 网络
- 下载
- wx.downloadFile
- DownloadTask
- .onProgressUpdate
- .abort
- 发起请求
- wx.request
- RequestTask
- .abort
- WebSocket
- wx.connectSocket
- wx.closeSocket
- wx.sendSocketMessage
- wx.onSocketOpen
- wx.onSocketClose
- wx.onSocketMessage
- wx.onSocketError
- SocketTask
- .close
- .onOpen
- .onClose
- .onError
- .onMessage
- .send
- 上传
- wx.uploadFile
- UploadTask
- .onProgressUpdate
- .abort
- 开放接口
- 游戏圈
- wx.createGameClubButton
- GameClubButton
- .onTap
- .offTap
- .show
- .hide
- .destroy
- 开放数据
- wx.getFriendCloudStorage
- wx.getGroupCloudStorage
- wx.getUserCloudStorage
- wx.removeUserCloudStorage
- wx.setUserCloudStorage
- wx.getSharedCanvas
- UserGameData
- KVData
- removeUserStorage
- setUserStorage
- 授权
- wx.authorize
- 防沉迷
- wx.checkIsUserAdvisedToRest
- 用户信息
- wx.getUserInfo
- wx.createUserInfoButton
- UserInfo
- UserInfoButton
- .show
- .hide
- .destroy
- .onTap
- .offTap
- 微信运动
- wx.getWeRunData
- 设置
- wx.getSetting
- wx.openSetting
- wx.createOpenSettingButton
- OpenSettingButton
- .onTap
- .offTap
- .show
- .hide
- .destroy
- AuthSetting
- 登录
- wx.login
- wx.checkSession
- checkSessionKey
- code2Session
- 意见反馈
- wx.createFeedbackButton
- FeedbackButton
- .onTap
- .offTap
- .show
- .hide
- .destroy
- 小程序跳转
- wx.navigateToMiniProgram
- 客服消息
- wx.openCustomerServiceConversation
- 开放数据域
- wx.getOpenDataContext
- wx.onMessage
- OpenDataContext
- .postMessage
- 接口调用凭证
- getAccessToken
- 内容安全
- imgSecCheck
- msgSecCheck
- 二维码
- createWXAQRCode
- getWXACode
- getWXACodeUnlimit
- 调试
- wx.setEnableDebug
- console
- .groupEnd
- .debug
- .log
- .info
- .warn
- .error
- .group
- 数据缓存
- wx.getStorage
- wx.getStorageSync
- wx.setStorage
- wx.setStorageSync
- wx.removeStorage
- wx.removeStorageSync
- wx.clearStorage
- wx.clearStorageSync
- wx.getStorageInfo
- wx.getStorageInfoSync
- 更新
- wx.getUpdateManager
- UpdateManager
- .onCheckForUpdate
- .onUpdateReady
- .onUpdateFailed
- .applyUpdate
- Worker
- wx.createWorker
- Worker
- .postMessage
- .onMessage
- .terminate
- 转发
- wx.getShareInfo
- wx.hideShareMenu
- wx.showShareMenu
- wx.updateShareMenu
- wx.shareAppMessage
- wx.onShareAppMessage
- wx.offShareAppMessage
- 广告
- wx.createRewardedVideoAd
- wx.createBannerAd
- RewardedVideoAd
- .load
- .show
- .onLoad
- .offLoad
- .onError
- .offError
- .onClose
- .offClose
- BannerAd
- .show
- .hide
- .destroy
- .onResize
- .offResize
- .onLoad
- .offLoad
- .onError
- .offError
- 界面
- 交互
- wx.showToast
- wx.showModal
- wx.hideToast
- wx.showLoading
- wx.hideLoading
- wx.showActionSheet
- 菜单
- wx.getMenuButtonBoundingClientRect
- wx.setMenuStyle
- 键盘
- wx.showKeyboard
- wx.hideKeyboard
- wx.updateKeyboard
- wx.onKeyboardInput
- wx.offKeyboardInput
- wx.onKeyboardConfirm
- wx.offKeyboardConfirm
- wx.onKeyboardComplete
- wx.offKeyboardComplete
- 状态栏
- wx.setStatusBarStyle
- 窗口
- wx.onWindowResize
- wx.offWindowResize
- 性能
- wx.getPerformance
- wx.triggerGC
- Performance
- .now
- 虚拟支付
- wx.requestMidasPayment
- midasCancelPay
- midasGetBalance
- midasPay
- midasPresent
- 定时器
- setTimeout
- clearTimeout
- setInterval
- clearInterval