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

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3519e-2bf70.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3519e-2bf70.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?