Vue2.5 旅游项目实例7 首页-周末游区域代码

新建Weekend.vue文件,并添加到Home.vue里

<template>
<div>
  <home-header></home-header>
  <home-swiper></home-swiper>
  <home-icons></home-icons>
  <home-recommend></home-recommend>
  <home-weekend></home-weekend>
</div>
</template>

<script>
import HomeHeader from './components/Header'
import HomeSwiper from './components/Swiper'
import HomeIcons from './components/Icons'
import HomeRecommend from './components/Recommend'
import HomeWeekend from './components/Weekend'
export default {
  name: 'Home',
  components: {
    HomeHeader,
    HomeSwiper,
    HomeIcons,
    HomeRecommend,
    HomeWeekend
  },
  data () {
    return {
    }
  }
}
</script>

发现周末游区域和推荐区域只是布局不一样,复制一份Recommend.vue的代码到Weekend.vue进行修改

<template>
<div>
  <div class="title">周末去哪儿</div>
  <ul>
    <li class="item border-bottom" v-for="item in WeekendList" :key="item.id">
      <div class="item-img-wrapper">
        <img class="item-img" :src="item.imgurl" alt="" />
      </div>
      <div class="item-info">
        <p class="item-title">{{item.title}}</p>
        <p class="item-desc">{{item.desc}}</p>
      </div>
    </li>
  </ul>
</div>
</template>

<script>
export default {
  name: 'HomeWeekend',
  data () {
    return {
      WeekendList: [
        {
          id: '0001',
          imgurl: 'https://imgs.qunarzz.com/sight/source/1603/6d/2f67ae0659f41f.jpg_r_640x214_bf6cbd0b.jpg',
          title: '北京-东京 5天跟团游',
          desc: '欢乐畅想 东京+横滨+富士山+镰仓+江之岛神社'
        },
        {
          id: '0002',
          imgurl: 'https://imgs.qunarzz.com/sight/source/1811/7e/476589267ebb41.jpg_r_640x214_bf599709.jpg',
          title: '尼泊尔9晚10天',
          desc: '悬崖酒店+超视觉两大歌舞+京津冀免费联运+骑大象'
        },
        {
          id: '0003',
          imgurl: 'https://imgs.qunarzz.com/sight/source/1811/f3/86173f863bef61.jpg_r_640x214_52b003ac.jpg',
          title: '【家庭游】升级碧桂园',
          desc: '张家界国家森林公园天门山玻璃桥凤凰双飞6日丨赠魅力湘西'
        }
      ]
    }
  }
}
</script>

<style lang="stylus" scoped>
@import '~styles/mixins.styl'
.title
  margin-top: .2rem
  line-height: .8rem
  background: #eee
  text-indent: .2rem
.item-img-wrapper
  width: 100%
  height:0
  overflow:hidden
  padding-bottom: 37.09%
  .item-img
    width: 100%
.item-info
  padding:.1rem
  .item-title
    line-height:.54rem
    font-size: .32rem
    ellipsis()
  .item-desc
    line-height:.4rem
    font-size: .28rem
    color:#ccc
    ellipsis()
</style>

效果图:

  

然后提交代码

git add .
git commit -m "推荐及周末区域代码"
git push

合并到master:

git checkout master
git merge index-recommend
git push

相关文章

本篇内容主要讲解“gitee如何上传代码”,感兴趣的朋友不妨来...
这篇“从gitee上下的代码如何用”文章的知识点大部分人都不太...
这篇文章主要介绍“gitee如何下载仓库里的项目”,在日常操作...
本篇内容主要讲解“怎么在Gitee上更新代码”,感兴趣的朋友不...
本文小编为大家详细介绍“怎么将工程托管到gitee”,内容详细...
这篇文章主要介绍了gitee中图片大小如何调整的相关知识,内容...