收藏
回答

setData函数怎么用啊?



const app = getApp()

Page({

data: {

t: [

     '../img/00.jpg',

     '../img/01.jpg',

    ]

}

})

……

onLoad: function () {

t: [

     '../img/03.jpg',

     '../img/04.jpg',

    ]

var temp = t;

this.setData({

t: temp

})

}

运行后老是提示以下错误:

WAService.js:3 thirdScriptError

t is not defined;at pages/index/index page lifeCycleMethod onLoad function

ReferenceError: t is not defined

……


之前在这里提问过:https://developers.weixin.qq.com/blogdetail?action=get_post_info&docid=c71cd57f9c941a6baacbfee51e35ce7c&token=834490836&lang=zh_CN


搞这个函数搞了一个多星期了,都弄不明白,请哪位高手赐教!不胜感激!

最后一次编辑于  2017-09-21
回答关注问题邀请回答
收藏

2 个回答

  • Z
    Z
    2017-09-22

    1楼正解,t变量没有声明

    2017-09-22
    有用
    回复
  • You can you up
    You can you up
    2017-09-22

    var t = [

    '../img/03.jpg',

    '../img/04.jpg',

    ]

    var temp = t;

    this.setData({

    t: temp

    })


    2017-09-22
    有用
    回复
登录 后发表内容