新手上路不懂这个错误怎么解决
发布于 5 年前 作者 mingzhang 11097 次浏览 来自 问答

onShareAppMessage: function () {

 },

 data :{

   currentTab:0,

   winWidth:0,

   winWidth:0,

   indicatorDots:false,

   autoplay:true,

   interval:5000,

   duration:1000,

   imgUrls:[

     “/image/haibao/1.jpg”,

     “/image/haibao/2.jpg”,

     “/image/haibao/3.jpg”,

     “/image/haibao/4.jpg”

   ]

 },

 onLoad:function(e){

   var page = this;

   wx.getSystemInfo({

     success: function(res) {

       console.log(res);

       page.setData({ winWidth:res.windowWidth});

       page.setData({winHeight:res.windowHeight});

     }

   })

   this.loadMovies();

 },

 switchNav:function(e) {

   var id = e.currentTarget.id;

   this.setData({currentTab:id});

 },

 loadMovies:function(){

   var page=this;

   var key = util.getDataKey();

   wx.request({

     url: https://api.douban.com/v2/movie/in_theaters?apikey=+key,

     method:‘GET’,

     header:{

       “Content-Type”:“json”

     },

     success:function(res){

       console.log(res);

       var subjects=res.data.subjects;

       var size=subjects.length;

       var len= parselnt(size /3 ) ;

       console.log(len);

       console.log(subject);

       page.setData({movies:subjects});

       page.setData({winHeight:(len +1)*230});

     }

   })

 }

自行检查了很多遍发现没有打错,但是这个错误一直不知道怎么解决,代码是除了问题的代码,求大神解答(还需要看别的代码的话再提供)

3 回复

是的,应该看看是不是引入了util

这个变量在util中的定义函数怎么写?求教

检查 var key = util.getDataKey();  是否正确引用,

回到顶部