ReferenceError:无法找到变量:i

时间:2018-02-15 01:17:20

标签: vue.js

我有Recommend.vue

<template>
  <div>Recommend</div>
</template>

<script>

  import { getRecommend } from '../../api/recommend'
  import { STATUS_CODE_OK } from '../../api/config'

  export default{

    data(){
      return {msg: 'hello vue'}
    },
    components: {},

    // hook
    created: function() {
      this._getRecommend()
      console.log('000999000')
    },

    // methods
    methods: {
      _getRecommend: function () {
        getRecommend().then((response) => {
          if (response.code === STATUS_CODE_OK) {
             console.log(response.data.slider)
          }
        })
      }
    }
  }
</script>

<style scoped>

</style>

但是我在浏览器控制台中收到了以下错误:

[Vue warn]: Error in created hook: "ReferenceError: Can't find variable: i"

found in

---> <Recommend> at src/components/sing/Recommend.vue
       <App> at src/App.vue
         <Root>

但在我的Recommned.vue中,没有变量i

我的推荐.js:

import jsonp from '../common/js/jsonp'
import {commonParams, options} from './config'

export function getRecommend() {
  const url = 'https://c.y.qq.com/musichall/fcgi-bin/fcg_yqqhomepagerecommend.fcg'

  const data = Object.assign({}, commonParams, {
    uin:0,
    platform:'h5',
    needNewCode:1
  })

  return jsonp(url, data, options)  

}

修改-1

enter image description here

0 个答案:

没有答案