创新互联百度小程序教程:swan.setDocumentTitle
- swan.setDocumentTitle
- 方法参数
- object 参数说明
 
- 示例
- 图片示例
- 代码示例
 
 
- 方法参数
swan.setDocumentTitle
不推荐使用。
解释:动态设置当前页面的标题。此方法为 web 版小程序专用方法,使用前需判断方法是否存在。
方法参数
Object object
object 参数说明
| 属性名 | 类型 | 必填 | 默认值 | 说明 | 
|---|---|---|---|---|
| title | String | 是 | 页面中 title 标签中的内容 | |
| success | Function | 否 | 接口调用成功的回调函数 | |
| fail | Function | 否 | 接口调用失败的回调函数 | |
| complete | Function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | 
示例
在开发者工具中打开
在开发者工具中打开
在 WEB IDE 中打开
请在开发者工具中,单击“预览”,输入您的 AppID,单击“ WEB 预览”,百度 App 中扫码体验。
图片示例
代码示例
- SWAN
- JS
Page({
setDocumentTitle() {
swan.setDocumentTitle({
title: '我是页面标题',
success: res => {
console.log('setDocumentTitle success', res);
},
fail: err => {
console.log('setDocumentTitle fail', err);
}
});
}
});
网站名称:创新互联百度小程序教程:swan.setDocumentTitle
文章URL:http://jxruijie.cn/article/dhipeic.html


 
                