• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

微信小程序实战–集阅读与电影于一体的小程序项目(四)

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

19.添加电影tabBar

tabBar文档

在posts目录下新建movies目录,分别创建四个文件

app.json配置tabBar

{
  "pages": [
    "pages/posts/post",
    "pages/welcome/welcome",
    
    "pages/posts/post-detail/post-detail",
    "pages/movies/movies"
  ],
  "window": {
    "navigationBarBackgroundColor": "#405f80"
  },
  "tabBar": {
    "borderStyle": "white",
    "list": [
      {
        "pagePath": "pages/posts/post",
        "text": "阅读",
        "iconPath": "images/tab/yuedu.png",
        "selectedIconPath": "images/tab/yuedu_hl.png"
      },
      {
        "pagePath": "pages/movies/movies",
        "text": "电影",
        "iconPath": "images/tab/dianying.png",
        "selectedIconPath": "images/tab/dianying_hl.png"
      }
    ]
  }
}

20.电影页面布局

目录结构

stars-template.wxml

<template name="starsTemplate">
  <view class="stars-container">
    <view class="stars">
      <image src="/images/icon/star.png"></image>
      <image src="/images/icon/star.png"></image>
      <image src="/images/icon/star.png"></image>
      <image src="/images/icon/star.png"></image>
      <image src="/images/icon/star.png"></image>
    </view>
    <text class="star-score ">9</text>
  </view>
</template>

stars-template.wxss

.stars-container {
  display: flex;
  flex-direction: row;
}

.stars {
  display: flex;
  flex-direction: row;
  height: 17rpx;
  margin-right: 24rpx;
  margin-top: 6rpx;
}

.stars image {
  padding-left: 3rpx;
  height: 17rpx;
  width: 17rpx;
}

.star-score {
  color: #1f3463;
}

movie-template.wxml

<import src="../stars/stars-template.wxml" />
<template name="movieTemplate">
    <view class="movie-container">
      <image class="movie-img" src='/images/xihongshi.png'></image>
      <text class="movie-title">西虹市首富</text>
      <template is="starsTemplate" />
    </view>
  </template>

movie-template.wxss

@import "../stars/stars-template.wxss";

@import "../stars/stars-template.wxss";

.movie-container {
  display: flex;
  flex-direction: column;
  padding: 0 22rpx;
}

.movie-img {
  width: 200rpx;
  height: 270rpx;
  padding-bottom: 20rpx;
}

.movie-title {
  margin-bottom: 16rpx;
  font-size: 24rpx;
}

movie-list-template.wxml

<import src="../movie/movie-template.wxml" />
<template name="movielistTemplate">
  <view class="movie-lsit-container">
    <view class="inner-container">
      <view class="movie-head">
        <text class="slogan">正在热映</text>
        <view class="more">
          <text class="more-text">更多</text>
          <image class="more-img" src="/images/icon/arrow-right.png"></image>
        </view>
      </view>

      <view class="movies-container">
        <template is="movieTemplate" />
        <template is="movieTemplate" />
        <template is="movieTemplate" />
      </view>
    </view>
  </view>

</template>

movie-list-template.wxss

@import "../movie/movie-template.wxss";

@import "../movie/movie-template.wxss";

.movie-list-container {
  background-color: #fff;
  display: flex;
  flex-direction: column;
}

.inner-container{
    margin: 0  auto 20rpx;
}

.movie-head {
  padding: 30rpx 20rpx 22rpx;
}

.slogan {
  font-size: 24rpx;
}

.more {
  float: right;
}

.more-text {
  vertical-align: middle;
  margin-right: 10rpx;
  color: #1f4ba5;
}

.more-img {
  width: 9rpx;
  height: 16rpx;
  vertical-align: middle;
}

.movies-container{
    display:flex;
    flex-direction: row;
}

movies.wxml

<import src="movie-list/movie-list-template.wxml" />

<view>
    <template is="movielistTemplate" />
    <template is="movielistTemplate" />
    <template is="movielistTemplate" />
</view>

movies.wxss

@import "movie-list/movie-list-template.wxss";

预览效果


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
微信公众号内h5页面调起微信小程序发布时间:2022-07-18
下一篇:
微信小程序开发总结与心得(一)发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap