账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    小程序数据绑定错误?
    25
    0

    为何AppData中没有postData对象?且页面显示空白?
    post.js
    Page({
    data:{
    },
    onLoad:function(){

    var iceCreamData={
      object:{
        date: "Jan 28 2017"
      },
      title: "小时候的冰棍儿与雪糕",
      postImg: "/images/post/post-4.jpg",
      avatar:"/images/avatar/avatar-5.png",
      content:"冰棍与雪糕绝对不是同一个东西。3到5毛钱的雪糕犹如现在的哈根达斯,而5分1毛的冰棍儿就像现在的老冰棒。时过境迁,...",
      readingNum:92,
      collectionNum:{
        array: [108]
      },
      commentNum: 7
    },
    this.setData({
      postData: iceCreamData
    })

    }
    })

    post.wxml
    <view>
    <view class='post-container'>

    <view class='post-author-date'>
      <image src='{{postData.avatar}}'></image>
      <text>{{postData.object.date}}</text>
    </view>
    <text class='post-tittle'>{{postData.title}}</text>
    <image class='post-image' src="{{postData.postImg}}" mode='aspectFill'></image>
    <text class='post-content'>{{postData.content}}</text>
    <view class='post-like'>
      <image src='/images/icon/wx_app_collect.png'></image>
      <text>{{postData.collectionNum.array[0]}}</text>
      <image src='/images/icon/wx_app_view.png'></image>
      <text>{{postData.readingNum}}</text>
      <image src='/images/icon/wx_app_message.png'></image>
      <text>{{postData.commentNum}}</text>
    </view>

    </view>
    </view>
    </view>

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部