vue failure problem in setTimeout

Look at the official website of the definition of setTimeout

 

 

 Then I look at the error code

let _this = this
timeoutID= window.setTimeout(_this.mapClick(), 200)

Solution two ways

method one: 

let _this = this
timeoutID= window.setTimeout(function(){_this.mapClick()}, 200)

Method Two:

let _this = this
timeoutID = setTimeout(() => {_this.mapClick()}, 200)

Guess you like

Origin www.cnblogs.com/yangshuzhong/p/11655979.html