今日头条源码剖析 include src= xxx.wxml 引入wxml(一)
<include src="recommend.wxml"/> 起作用
<view class="{{flag==0?'select':'normal'}}" id="0" bindtap="switchNav">推荐</view> id="0" 细节
<view class="content">
<view class="bg">
<view class="name">今日头条</view>
<view class="search">
<view>
<image src="/images/icon/search.jpg" style="width:14px;height:14px"></image>
</view>
<view>
<input type="text" placeholder="搜你想要的"/>
</view>
</view>
</view>
<view class="navbg">
<view class="nav">
<scroll-view class="scroll-view_H" scroll-x="true" bindscrolltoupper="upper" bindscrolltolower='lower' bindscroll='scroll'>
<view class="scroll-view_H">
<view>
<view class="{{flag==0?'select':'normal'}}" id="0" bindtap="switchNav">推荐</view>
</view>
<view>
<view class="{{flag==1?'select':'normal'}}" id="1" bindtap="switchNav">热点</view>
</view>
<view>
<view class="{{flag==2?'select':'normal'}}" id="2" bindtap="switchNav">北京</view>
</view>
<view>
<view class="{{flag==3?'select':'normal'}}" id="3" bindtap="switchNav">社会</view>
</view>
<view>
<view class="{{flag==4?'select':'normal'}}" id="4" bindtap="switchNav">娱乐</view>
</view>
<view>
<view class="{{flag==5?'select':'normal'}}" id="5" bindtap="switchNav">问答</view>
</view>
<view>
<view class="{{flag==6?'select':'normal'}}" id="6" bindtap="switchNav">图片</view>
</view>
<view>
<view class="{{flag==7?'select':'normal'}}" id="7" bindtap="switchNav">科技</view>
</view>
<view>
<view class="{{flag==8?'select':'normal'}}" id="8" bindtap="switchNav">汽车</view>
</view>
<view>
<view class="{{flag==9?'select':'normal'}}" id="9" bindtap="switchNav">体育</view>
</view>
</view>
</scroll-view>
</view>
<view class="add">+</view>
</view>
<swiper current="{{flag}}" style="height:800px;" autoplay>
<swiper-item>
<include src="recommend.wxml"/>
</swiper-item>
<swiper-item>
我是热点内容
</swiper-item>
<swiper-item>
我是北京内容
</swiper-item>
<swiper-item>
我是社会内容
</swiper-item>
<swiper-item>
我是娱乐内容
</swiper-item>
<swiper-item>
我是问答内容
</swiper-item>
<swiper-item>
我是图片内容
</swiper-item>
<swiper-item>
我是科技内容
</swiper-item>
<swiper-item>
我是汽车内容
</swiper-item>
<swiper-item>
我是体育内容
</swiper-item>
</swiper>
</view>
<view class="item" bindtap="seeDetail">
<view class="title">开工红包哪家强?阿里最壕,腾讯像春运</view>
<view class="pic">
<image src="/images/news/1.jpg" style="width:30%;height:69px;"></image>
<image src="/images/news/2.jpg" style="width:30%;height:69px;"></image>
<image src="/images/news/3.jpg" style="width:30%;height:69px;"></image>
</view>
<view class="info">
<view class="desc">
<text>志趣科技</text>
<text>48评论</text>
<text>6分钟之前</text>
</view>
<view class="opr">
<view>x</view>
</view>
</view>
</view>
<view class="hr"></view>
<view class="item" bindtap="seeDetail">
<view class="title">C1驾驶证使用新规定(2017),你了解吗?</view>
<view class="pic">
<image src="/images/news/4.jpg" style="width:30%;height:69px;"></image>
<image src="/images/news/5.jpg" style="width:30%;height:69px;"></image>
<image src="/images/news/6.jpg" style="width:30%;height:69px;"></image>
</view>
<view class="info">
<view class="desc">
<text>我们都爱SUV</text>
<text>19评论</text>
<text>16分钟之前</text>
</view>
<view class="opr">
<view>x</view>
</view>
</view>
</view>
<view class="hr"></view>
<view class="item" bindtap="seeDetail">
<view class="title">洗澡是先洗头还是先洗身体?</view>
<view class="pic">
<image src="/images/news/7.jpg" style="width:30%;height:69px;"></image>
<image src="/images/news/8.jpg" style="width:30%;height:69px;"></image>
<image src="/images/news/9.jpg" style="width:30%;height:69px;"></image>
</view>
<view class="info">
<view class="desc">
<text>头条回答</text>
<text>148评论</text>
<text>61分钟之前</text>
</view>
<view class="opr">
<view>x</view>
</view>
</view>
</view>
<view class="hr"></view>
<view class="item" bindtap="seeDetail">
<view class="title">年后出门闯红灯别慌,新交规规定这4种情况系,既不扣分也不罚款?</view>
<view class="pic">
<image src="/images/news/10.jpg" style="width:30%;height:69px;"></image>
<image src="/images/news/11.jpg" style="width:30%;height:69px;"></image>
<image src="/images/news/12.jpg" style="width:30%;height:69px;"></image>
</view>
<view class="info">
<view class="desc">
<text>爱车族</text>
<text>44评论</text>
<text>126分钟之前</text>
</view>
<view class="opr">
<view>x</view>
</view>
</view>
</view>
<view class="hr"></view>