JS报Uncaught SyntaxError: Unexpected identifier错误,这是咋回事?

img


    // 自动保存
    timerHandle() {
      clearInterval(this.timer) // 进来之前先清除一次
      this.timer = window.setInterval(() => {
        setTimeout(this.preserve("audit"), 0)
      }, 60000)
    },

百度查了下 资料 基本上都是说是少个逗号或者冒号导致的,
但是我看了下我的代码 实在照不出来是哪出现了问题

setTimeout(() => { this.preserve("audit") }, 0)

实在不行,就采用二分法缩小范围。比如你这个方法,两行代码,注释掉一行,看是否还报错,一步一步查。

小伙子你第6行这么写,对吗?

setTimeout(this.preserve("audit"), 0) 这个注释掉还报错吗?不报的话就是这的问题。按照楼上的写法