docs: fix some doc error @rex-zsd (#963)

This commit is contained in:
rex 2018-11-27 11:55:40 +08:00 committed by neverland
parent 1a3438a98a
commit a2546d8623
6 changed files with 59 additions and 64 deletions

View File

@ -24,37 +24,33 @@
```javascript
Page({
data() {
return {
show: false,
actions: [
{
name: '选项'
},
{
name: '分享',
subname: '描述信息',
openType: 'share'
},
{
loading: true
},
{
name: '禁用选项',
disabled: true
}
]
};
data: {
show: false,
actions: [
{
name: '选项'
},
{
name: '分享',
subname: '描述信息',
openType: 'share'
},
{
loading: true
},
{
name: '禁用选项',
disabled: true
}
]
},
methods: {
onClose() {
this.setData({ show: false });
},
onClose() {
this.setData({ show: false });
},
onSelect(event) {
console.log(event.detail);
}
onSelect(event) {
console.log(event.detail);
}
});
```

View File

@ -25,20 +25,18 @@
```
``` javascript
export default {
Page({
data: {
active: 0
},
methods: {
onChange(event) {
wx.showToast({
icon: 'none',
title: `切换至第${event.detail}项`
});
}
onChange(event) {
wx.showToast({
icon: 'none',
title: `切换至第${event.detail}项`
});
}
};
});
```
### BadgeGroup API

View File

@ -32,6 +32,7 @@ Page({
maxDate: new Date(2019, 10, 1).getTime(),
currentDate: new Date().getTime()
},
onChange(event) {
this.setData({
currentDate: event.detail.value
@ -57,6 +58,7 @@ Page({
currentDate: new Date().getTime(),
minDate: new Date().getTime()
},
onChange(event) {
this.setData({
currentDate: event.detail.value
@ -82,6 +84,7 @@ Page({
currentDate: new Date().getTime(),
minDate: new Date().getTime()
},
onChange(event) {
this.setData({
currentDate: event.detail.value
@ -109,6 +112,7 @@ Page({
minHour: 9,
maxHour: 23
},
onChange(event) {
this.setData({
currentDate: event.detail.value

View File

@ -25,16 +25,14 @@
```
```js
export default {
methods: {
onClickLeft() {
wx.showToast({ title: '点击返回', icon: 'none' });
},
onClickRight() {
wx.showToast({ title: '点击按钮', icon: 'none' });
}
Page({
onClickLeft() {
wx.showToast({ title: '点击返回', icon: 'none' });
},
onClickRight() {
wx.showToast({ title: '点击按钮', icon: 'none' });
}
}
});
```
#### 高级用法

View File

@ -36,26 +36,24 @@
```
```js
export default {
methods: {
onClose(event) {
const { position, instance } = event.detail;
switch (position) {
case 'left':
case 'cell':
Page({
onClose(event) {
const { position, instance } = event.detail;
switch (position) {
case 'left':
case 'cell':
instance.close();
break;
case 'right':
Dialog.confirm({
message: '确定删除吗?'
}).then(() => {
instance.close();
break;
case 'right':
Dialog.confirm({
message: '确定删除吗?'
}).then(() => {
instance.close();
});
break;
}
});
break;
}
}
}
});
```
### API

View File

@ -54,13 +54,14 @@ Page({
```javascript
Page({
data() {
data: {
active: 0,
icon: {
normal: '//img.yzcdn.cn/icon-normal.png',
active: '//img.yzcdn.cn/icon-active.png'
}
},
onChange(event) {
console.log(event.detail);
}