Vue2.5从零开发猫眼⑥——个人中心组件开发

Vue2.5从零开发猫眼系列以更新完毕

Vue2.5从零开发猫眼①——前言 

Vue2.5从零开发猫眼②——项目开始前准备

Vue2.5从零开发猫眼③——启动页开发

Vue2.5从零开发猫眼④——Home页开发

Vue2.5从零开发猫眼⑤——影院页开发

Vue2.5从零开发猫眼⑥——个人中心组件开发

Vue2.5从零开发猫眼⑦——City组件开发

Vue2.5从零开发猫眼⑧——引入store、LocalStorage和优化上线

个人中心组件开发

该组件比较简单

<template>
  <div>
      <common-header :title="title" :back="true" @goBack="goBack"></common-header>
    <div class="my-center">
      <div class="header">
        <img class="img" src="./images/icon.png" />
        <p class="name">猫眼</p>
      </div>
      <div class="container">
        <div class="group">
          <div class="orders">
            <div class="title">我的订单</div>
            <div class="list">
                <div class="order-item movie">
                    <p>电影</p>
                </div>
                <div class="order-item store">
                  <p>商城</p>
                </div>
            </div>
          </div>
        </div>
        <div class="group">
          <div class="item scale-1px"><div>在线观影</div></div>
          <div class="item scale-1px"><div>优惠券</div></div>
          <div class="item scale-1px"><div>折扣卡</div></div>
        </div>
      </div>
    </div>
    <common-footer :bottom-active="bottomActive"></common-footer>
  </div>
</template>

<script>
import CommonHeader from '../../components/header/Header'
import CommonFooter from '../../components/footer/Footer'
export default {
  name: 'My',
  components: {
    CommonHeader,
    CommonFooter
  },
  data () {
    return {
      title: '我的',
      bottomActive: 2
    }
  },
  methods: {
    goBack() {
      this.$router.back()
    }
  }
}
</script>
<style lang="stylus" scoped>
  @import '~stylus/variable.styl'
  .my-center
    min-height: 100%;
    display: flex;
    flex-direction: column;
    .header
      background-color: $bgColor;
      height: 150px;
      overflow: hidden;
      text-align: center;
      img
        display: inline-block;
        margin-top: 30px;
        width: 60px;
        height: 60px;
        border-radius: 60px;
        border: 3px solid #fff;
      .name
        margin-top: 7px;
        font-size: 16px;
        line-height: 22.5px;
        color: #fff;
    .container
      flex: 1;
      .group
        margin-top: 10px;
        background: #fff;
      .orders
        padding: 0 15px;
        position: relative;
        overflow: hidden;
        text-align: center;
        .title
          position: relative;
          margin: 13px 0 0;
          font-size: 15px;
          line-height: 21px;
          height: 21px;
          color: #333;
          z-index: 9;
          display: inline-block;
          width: 80px;
          background-color: #fff;
        .list
          overflow: hidden;          
        .order-item
          float: left;
          height: 97px;
          background-repeat: no-repeat;
          background-position: top;
          background-size: 42px auto;
          margin-top: 18px;
          width: 50%;
          p
            position: relative;
            top: 53px;
            text-align: center;
            font-size: 15px;
            line-height: 21px;
            height: 21px;
            margin: 0;
            color: #333;
          &.movie
            background-image: url(./images/movie.png);
          &.store
            background-image: url(./images/store.png);
      .item
        position: relative;
        height: 44px;
        line-height: 44px;
        font-size: 15px;
        margin-left: 15px;
        padding-right: 15px;
        &::before
          position: absolute;
          right: 15px;
          top: 18px;
          display: inline-block;
          content: "";
          width: 8px;
          height: 8px;
          border-left: 1px solid #ccc;
          border-top: 1px solid #ccc;
          transform: rotate(135deg);
</style>

在router\index.js 引入My组件

import My from '@/pages/my/My'
{
  path: '/my',
  name: 'my',
  component: My
}

至此,my组件已经完成,效果如下: image

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值