• vue五十五:电影院售票项目案例之项目数据请求和iconfont使用


    一:数据请求

    nowplaying
    url: 'https://m.maizuo.com/gateway?cityId=110100&pageNum=1&pageSize=10&type=1&k=8629683',
    headers: {
      'X-Client-Info': '{"a":"3000","ch":"1002","v":"5.0.4","e":"1597564345482951892566017","bc":"110100"}',
      'X-Host': 'mall.film-ticket.film.list'
    }

    在mounted生命周期周获取数据,并赋值

    渲染

    <template>
    <div>
    nowplaying
    <ul>
    <li v-for="data in datalist" :key="data.filmId" @click="handleChangePage(data)">
    {{ data.name }}
    </li>
    </ul>
    </div>
    </template>

    <script>
    import axios from 'axios'

    export default {
    data() {
    return {
    datalist: [],
    total: 0
    }
    },
    mounted() {
    axios({
    url: 'https://m.maizuo.com/gateway?cityId=110100&pageNum=1&pageSize=10&type=1&k=8629683',
    headers: {
    'X-Client-Info': '{"a":"3000","ch":"1002","v":"5.0.4","e":"1597564345482951892566017","bc":"110100"}',
    'X-Host': 'mall.film-ticket.film.list'
    }
    }).then(res => {
    console.log(res.data)
    this.datalist = res.data.data.films
    this.total = res.data.data.total
    })
    },
    }
    </script>

    <style scoped>

    </style>

    app组件加全局样式

    <style lang="scss">
    * {
    margin: 0;
    padding: 0;
    }

    html {
    height: 100%;
    }

    li {
    list-style: none;
    }
    </style>

    <style lang="scss" scoped>
    .isActive {
    color: blue;
    }

    nav {
    position: fixed;
    bottom: 0px;
    left: 0px;
    100%;
    height: 50px;
    background: white;
    }

    ul {
    display: flex;

    li {
    flex: 1;
    line-height: 50px;
    text-align: center;
    }
    }
    </style>

    效果

    二:iconfont使用

    下载iconfont放到项目的public下

    在index.html中引入iconfont

    在tabbar中使用

    <template>
    <nav>
    <ul>
    <router-link to="/film" tag="li" activeClass="isActive">
    <i class="iconfont icon-form"></i>
    film
    </router-link>
    <router-link to="/cinema" tag="li" activeClass="isActive">
    <i class="iconfont icon-form"></i>
    cinema
    </router-link>
    <router-link to="/center" tag="li" activeClass="isActive">
    <i class="iconfont icon-form"></i>
    center
    </router-link>
    </ul>
    </nav>
    </template>
    讨论群:249728408
  • 相关阅读:
    关于Delphi中RS Float字段只有4位及OADateTime不能显示到秒的解决办法
    xml特殊字符处理(js)
    总结一下最近将163邮箱拖动效果改成兼容Firefox遇到的问题
    在XIB里面关于@property,@synthesize,release,dealloc的怪现象
    关于Core Data里面删除了一个被retain的NSManagedObject
    Hello cnblogs' world!
    html5离线应用程序 Amy
    css3布局相关的样式 Amy
    html5拖放API Amy
    css3MediaQueries的相关样式 Amy
  • 原文地址:https://www.cnblogs.com/zhongyehai/p/13513079.html
Copyright © 2020-2023  润新知