<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