17.vue移动端项目二
FilmList.vue 电影列表
<template><div class="mz-film-list"><!-- 正在热映 https://m.maizuo.com/v4/api/film/now-playing?__t=1533018029103&page=1&count=7 --><!-- 即将上映 https://m.maizuo.com/v4/api/film/coming-soon?__t=1533018029121&page=1&count=7 --><ul class="film-list-nav"><li @click="show(index)" v-for="(item,index) in types" :class="{[item.type]:true,active:iNow==index}" :key="item.id">{{item.title}}</li></ul><ul class="film-list-wrap"><router-link tag="li" :to="{name:'filmdetail',params:{id:item.id}}" v-for="item in arr" :key="item.id"><img class="fl film-item-img" :src="item.poster.thumbnail" /><div class="film-desc"><div class="film-grade" v-if="item.isNowPlaying==true">{{item.grade}}</div><div class="film-name">{{item.name}}</div><div class="film-intro">{{item.intro}}</div><template v-if="item.isNowPlaying==true"><div class="film-counts"><span class="film-count-color">{{item.cinemaCount}}</span><span>家影院上映</span><span class="film-count-color" >{{item.watchCount}}</span><span>人购票</span></div></template><template v-else><div class="film-premiere-date"><span>12月31日上映</span><span> </span><span>星期一</span></div></template></div><!-- <img class="fl film-item-img" src="https://pic.maizuo.com/usr/movie/aa7872b51e94b5f85a73a34bb93bd21b.jpg?x-oss-process=image/resize,m_fixed,h_0,w_300" /><div class="film-desc"><div class="film-grade">8.5</div><div class="film-name">我不是药神</div><div class="film-intro">一场关于“救赎”的拉锯战</div><div class="film-counts"><span class="film-count-color1">199</span><span>家影院上映</span><span class="film-count-color1" >0</span><span>人购票</span></div><div class="film-premiere-date"><span>12月31日上映</span><span> </span><span>星期一</span></div></div> --></router-link></ul></div>
</template><script>
export default {name:"mz-film",data(){return {iNow:0,types:[{id:Math.random(),type:"now-playing",title:"正在热映"},{id:Math.random(),type:"coming-soon",title:"即将上映"}],page:1,count:7,isLoaded:true,arr:[]}},methods:{show(index){//数据初始化this.iNow = index;this.isLoaded = true;this.page = 1;this.arr = [];this.getFilms();},getFilms(){if(!this.isLoaded){return;}let params = {__t:Date.now(),page:this.page,count:this.count};let url = `http://localhost:9000/mz/v4/api/film/${this.types[this.iNow].type}`;this.$http.get(url,{params}).then(res=>{this.arr=this.arr.concat(res.data.data.films);console.log(this.arr);if(res.data.data.films.length == 0){this.isLoaded = false;}});}},created(){this.getFilms();},mounted(){window.onscroll = () =>{let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;let scrollHeight = document.body.scrollHeight;let clientHeight = document.documentElement.clientHeight;if(scrollTop + clientHeight == scrollHeight){if(this.isLoaded){this.page++;console.log("到底了",this.page);this.getFilms();}}};}
}
</script>
<style>
.mz-film-list{padding-left: 15px;padding-right: 15px;}
.film-list-nav {height: 46px;margin: 0 auto;border-bottom: solid #fe6e00 1px;
}.film-list-nav li{float: left;width: 50%;height: 100%;text-align: center;font-size: 16px;line-height: 46px;color: #6a6a6a;cursor: pointer;
}
.film-list-nav li.active {color: #fe6e00; border-bottom: solid;
}.film-list-wrap li{width:345px; height: 125px;padding: 20px 0;border-bottom: dashed 1px #c9c9c9;cursor: pointer;}.film-list-wrap .film-item-img {width: 60px;float: left;overflow: hidden;
}.film-list-wrap .film-desc {width: 75%;padding-left: 15px;display: inline-block;
}
.film-list-wrap .film-desc .film-grade {float: right;font-size: 16px;line-height: 32px;color: #fc7103;
}
.film-list-wrap .film-desc .film-intro{color: #8e8e8e;font-size: 12px;line-height: 32px;
}
.film-list-wrap .film-desc .film-name {font-size: 16px; line-height: 32px;color: #000;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;
}
.film-list-wrap .film-desc .film-counts {line-height: 32px;line-height: 24px;color: #8e8e8e;font-size: 12px;
}
.film-list-wrap .film-desc .film-count-color {color: #8aa2bf;}
.film-list-wrap .film-desc .film-premiere-date {line-height: 32px;line-height: 24px;color: #ffb375;font-size: 12px;
}
</style>
FilmDetail.vue
详情页,没写样式
<template><div class="mz-film-detail">mz-film-detail xxx {{film}}</div>
</template><script>
export default {name: "mz-detail",props:["id"],data () {return {film:{},}},methods:{getFilmDeatil(){//now-playing | coming-soon//https://m.maizuo.com/v4/api/film/4266?__t=1533093597327let params = {__t:Date.now()}; let url = `http://localhost:9000/mz/v4/api/film/${this.id}`;this.$http.get(url,{params}).then(res=>{ this.film = res.data.data.film;});}},created(){ this.getFilmDeatil();}
}
</script>
<style>
.mz-film-list{padding-left: 15px;padding-right: 15px;}</style>
Cinema.vue
影院详情
<template><div class="mz-cinema"><dl class="district" v-for="(item,key,index) in oCinema" :key="item.id"><template v-if="index==0"><dt @click="show(item)" class="title">{{item.name}}</dt><!-- //{{item.data}} --><dd v-show="!item.isShow" class="wraper" v-for="obj in item.data" :key="obj.id"><p>{{obj.name}}}</p><p>{{obj.address}}}</p><p>距离未知</p></dd> </template><template v-else-if="index!=0"><dt @click="show(item)" class="title">{{item.name}}</dt><!-- //{{item.data}} --><dd v-show="item.isShow" class="wraper" v-for="obj in item.data" :key="obj.id"><p>{{obj.name}}}</p><p>{{obj.address}}}</p><p>距离未知</p></dd> </template><!-- <dt class="title">市南区</dt><dd class="wraper"><p>横店电影城青岛中山路店</p><p>青岛市市南区中山路67号乐喜客来广场2-4层</p><p>距离未知</p></dd> --> </dl></div>
</template><script>
import {mapActions,mapMutations,mapState,mapGetters} from "vuex";
export default {name: "mz-cinema",data() {return {oCinema:{}, }},methods:{ ...mapActions({yingyuan:"yingyuanAction"}),show(item){ item.isShow = !item.isShow;console.log(item.isShow);},getCinemas(){//https://m.maizuo.com/v4/api/cinema?__t=1533103317490let url = "http://localhost:9000/mz/v4/api/cinema";let params = {params:{__t:Date.now()}};this.$http.get(url,params).then(res=>{this.arr = res.data.data.cinemas;let cinemas = res.data.data.cinemas;let oCinema = {};//数据初始化cinemas.forEach(item => {//console.log("item:",item.id,item.name,JSON.stringify(item.district));//shi-nan-quif(oCinema[item.district.pinyin]){//在每个区里面添加数据oCinema[item.district.pinyin].data.push({id:item.id,name:item.name,pinyin:item.pinyin,address:item.address});} else {oCinema[item.district.pinyin] = {id:Math.random(),name:item.district.name,isShow:false,data:[{id:item.id,name:item.name,pinyin:item.pinyin,address:item.address}]}; } });this.oCinema = oCinema;});}},created(){this.getCinemas();this.yingyuan() },
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>.district .title {height: 40px;line-height: 40px;font-size: 14px;padding-left: 16px;background: #e1e1e1;margin-bottom: 1px;color: #636363;cursor: pointer;
}.district .wraper{margin: 0 auto;border-bottom: 1px solid #e1e1e1;cursor: pointer;min-width: 320px;
}
</style>
转载于:https://www.cnblogs.com/zhongchao666/p/9463028.html
17.vue移动端项目二相关推荐
- vue移动端项目缓存问题实践
最近在做一个vue移动端项目,被缓存问题搞得头都大了,积累了一些经验,特此记录总结下,权当是最近项目问题的一个回顾吧! 先描述下问题场景:A页面->B页面->C页面.假设A页面是列表页面, ...
- 2021-03-24 从零开始搭建vue移动端项目
从零开始搭建vue移动端项目 一.Vue项目搭建 二.使用步骤 1.初始化 2.路由 3.Vuex(状态管理) 4.Axios(数据请求模块) 5.使用Less 6.移动端适配 7.注意事项 8.移动 ...
- Vue购物商城项目(二) 数据请求使用
Vue购物商城项目(二) 文章目录 Vue购物商城项目(二) 前言 一.请求数据 request.js home.js Home.vue 二.使用数据 总结 前言 1.这里面包含了大量的.我的个人理解 ...
- Vue 移动端项目创建
前言 移动端我们一般通过Vue脚手架手动自定义创建项目, 只需要Node环境我们就可以通过npm下载Vue脚手架,通过命令创建项目. npm下载脚手架 npm install -g @vue/cli ...
- vue移动端项目日历组件,月周切换,点击进入上/下一个月
项目场景: Vue移动端项目的日历组件,移动端如果没有别的特别要求,一般用vant中的日历组件就OK,这里用的另一个.组件是网上找的,原网址:vue-hash-calendar,需要的请自行去看. 我 ...
- Vue移动端项目---尚硅谷外卖
文章目录 Vue移动端项目--尚硅谷外卖 项目目录结构介绍 移动端适配 头部和底部导航 登录注册页面 密码登录 短信登录 Profile页面 未登录 已登录 Msite页面 首页导航 ShopList ...
- vue移动端项目实现真机调试
在vue移动端项目中,我们可以通过真机调试来更好的看到项目实际运行在移动端的效果. 下面就来介绍一下实现的方法: 1.使手机与电脑连接在同一个wifi下 2.修改vue.config.js文件配置 将 ...
- vue移动端项目实现定位
vue移动端项目实现定位 腾讯地图官方地址 <template><div><!-- 定义地图显示容器 --><div id="container&q ...
- vue移动端项目基础框架搭建
本文章,主要提供vue移动端项目基础框架搭建思路,每个独立的模块网上有很多相关的文档. 移动端vue项目基础框架搭建,主要包括6个步骤 项目使用的脚手架vue-cli搭建模板,2.使用淘宝lib-fl ...
最新文章
- python爬虫完整实例-python爬虫实战之爬取京东商城实例教程
- centos7.3安装elasticsearch-head
- [Buzz.Today]2013.03.14
- BZOJ-4300 绝世好(蛋疼)题 DP(递推)
- String s = new String(xyz);创建了几个对象?
- 【POJ1584】A Round Peg in a Ground Hole,第一次的计算几何
- fate框架找不到 flow 命令
- c语言输入一串数字存入数组_在Excel中快速输入,竟是输入一串数字?
- Unity编辑器汉化教程
- Window 平台下添加 tree 命令
- 无纸化会议桌的应用及说明
- html 英文花体,七夕花体英文文案
- VisualStudio各版本的安装与使用(持续更新)
- 计算机主板 也叫系统板或母版,什么是主板
- c语言源程序自动评判系统,源程序的自动评判系统.PDF
- 机器视觉运动控制一体机应用例程|锂电池组装线上的读码应用
- 多设备时设置default serial的方法
- java叠加两张png带透明图片
- 唐宇迪之tensorflow学习笔记项目实战(LSTM情感分析)
- 轻量级渲染管线_轻量级渲染管道:优化实时性能
热门文章
- 真实赛车3,SPEEDRUSH TV 第3季,第3阶段(第3天),直线加速赛
- EMNLP2021 “Transformer+预训练”再下一城,港科大开源高效的多模态摘要总结网络...
- 免费数据集获取加速器|Graviti Open Datasets
- PyTorch一年增长194%,超越TensorFlow指日可待
- CVPR2019 | AlphaPose升级!上交大开源密集人群姿态估计代码
- 在Python3里有的变量前面有个*号,或许你不知道,没关系,看文
- Fastformer:史上最强最快Transformer!清华、MSRA出品!
- 2019年,北大毕业生都去哪儿了?
- 回顾 | AAAI 2019最佳论文公布,CMU、斯坦福、MIT上榜
- 【Python】Python实战从入门到精通之六 -- 教你读取文件