Vue quoted this to report the problem.

if you annotate the this._getRecommend of created, you will not make a mistake. May I ask which problem it is?

clipboard.png

< script type= "text/ecmascript-6" >
import {getRecommend} from "api/recommend"
import {ERR_OK} from" api/config"

export default {
created () {

this._getRecommend()

},
methods: {

_getRecommend() {
  getRecommend().then((res) => {
    if (res.code === ERR_OK) {
      console.log(res.data.slider)
    }
  })
}

}
}
< / script >

what result do you expect? What is the error message actually seen?


import {getRecommend} from 'api/recommend' you need to check what the getRecommend in api/recommend is, and if you can't solve it, you'd better post the corresponding code.


want to use this interface


amount. Is your getRecommend method an instance of promise? the error prompt is not a function. Try not to use the then method and call it directly to see if you can still report an error

.
Menu