提交 26b46e56 编写于 作者: lizhongyi_'s avatar lizhongyi_

docs update function.md

上级 ec59205b
......@@ -356,34 +356,3 @@ fn = function () {
}
fn()
```
## 参数为回调函数
方法参数为一个回调函数时,如果需要多次调用该回调,则该方法需要以 `on` 开头
举例:
```ts
export function onCallback(callback: (sth:string) => void) {
/**
* 模拟多次回调
*/
let count = 1
let taskId = -1
taskId = setInterval(function() {
callback("" + count + "次回调")
count++;
console.log("count",count)
if(count > 3){
clearInterval(taskId)
}
}, 500);
}
```
如果违背此原则,则`uni-app` 平台多次调用时会提示 `method not found`
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册