V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
ppbaozi
V2EX  ›  程序员

初始值取不到,刚上手小程序就遇到坑了吗

  •  
  •   ppbaozi · 2018-01-11 18:04:42 +08:00 · 1239 次点击
    这是一个创建于 2288 天前的主题,其中的信息可能已经有所发展或是发生改变。

    代码

    Page({
      data: {
        limit: 15,
        keyword: 'keyword',
        result: []
      },
      onLoad() {
        console.log(this.limit, this.keyword)
        this.setData({
          limit: 10
        })
        this.keyword = 'search'
      },
      onReady() {
        console.log(this.limit, this.keyword)
      },
      onShow() {
        console.log(this.limit, this.keyword)
      }
    ...
    

    Console

    img

    2 条回复    2018-01-11 18:17:46 +08:00
    wsxyeah
        1
    wsxyeah  
       2018-01-11 18:11:25 +08:00 via iPhone
    ppbaozi
        2
    ppbaozi  
    OP
       2018-01-11 18:17:46 +08:00
    @wsxyeah
    完美
    结帖...
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5453 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 07:03 · PVG 15:03 · LAX 00:03 · JFK 03:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.