小程序url传参如何写变量

<navigator url="../../pages/newsDetail/newsDetail?id={{news.id}}">
    <view class="list-item">
      <view class="little-item">
        <view class="left-box">
          <image src="{{news.thumb[0]}}"></image>
        </view>
        <view class="right-box">
          <view class="title">{{news.title}}</view>
          <view class="info">
            <view class="author-info">
              <view class="author-avatar">
                <image src="{{news.pubInfo.avatarUrl}}"></image>
              </view>
              <view class="author-other">
                <view>{{news.authorName}}</view>
                <!-- <view>{{news.pubInfo.introduction}}</view> -->
              </view>
            </view>
            <view>{{news.like}}赞 {{news.createAt}}</view>
          </view>
        </view>
      </view>
    </view>
  </navigator>

直接看第一行,直接在双引号里写静态部分,用双大括号绑定变量即可。

posted @ 2018-08-09 10:50  蓓蕾心晴  阅读(1020)  评论(0编辑  收藏  举报