Skip to content

Commit

Permalink
doc: 完善文档
Browse files Browse the repository at this point in the history
  • Loading branch information
jimczj committed Jun 22, 2020
1 parent 74a9657 commit 7f388aa
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,31 @@ import { TimerBehavior } from 'timer-miniprogram'
Page({
behaviors: [TimerBehavior],
onReady() {
this.$setTimeout(() => {
const timer1 = this.$setTimeout(() => {
console.log('setTimeout')
})
this.$setInterval(() => {
console.log('setTimeout')
this.$clearTimeout(timer1)

const timer2 = this.$setInterval(() => {
console.log('setInterval')
})
this.$clearInterval(timer2)
}
})

// 在组件中使用
Components({
behaviors: [TimerBehavior],
ready() {
this.$setTimeout(() => {
const timer1 = this.$setTimeout(() => {
console.log('setTimeout')
})
this.$setInterval(() => {
console.log('setTimeout')
this.$clearTimeout(timer1)

const timer2 = this.$setInterval(() => {
console.log('setInterval')
})
this.$clearInterval(timer2)
}
})
```
Expand Down

0 comments on commit 7f388aa

Please sign in to comment.