鍍金池/ 問答/HTML/ 在vue 中 語法報(bào)錯(cuò)

在vue 中 語法報(bào)錯(cuò)

在vue中,代碼如下:

  methods: {
      isActive (index) {
        return index = this.selectedIndex
      }
}

但是報(bào)錯(cuò): ? http://eslint.org/docs/rules/... Return statement should not contain assignment
有沒有伙伴遇到過這種情況??

回答
編輯回答
凝雅

index == this.selectedIndex
return index

2017年1月22日 09:52
編輯回答
葬憶

result 語句不允許賦值
你應(yīng)該是少寫了=;

return index === this.selectedIndex
2018年8月1日 21:43
編輯回答
帥到炸

return里不應(yīng)該包含賦值語句??梢栽囋?/p>

index === this.selectedIndex
return index
2017年4月3日 03:45