if you annotate the this._getRecommend of created, you will not make a mistake. May I ask which problem it is?
< 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 >