仿简书页面代码示例(2)

这次为登陆后会显示的几个主要页面

  • 关注页面


    关注.png
<template>
    <b-row>
      <b-col cols="3">
        <v-jianyouquan></v-jianyouquan>
      </b-col>
      <b-col cols="8">
        <router-view></router-view>
      </b-col>
    </b-row>
</template>

<script>
  import vJianyouquan from '../common/Jianyouquan'
  import vTimeline from '../common/Timeline'
    export default {
        name: "Subscriptions",
      components:{
          vJianyouquan,
          vTimeline
      }
    }
</script>

<style scoped>

</style>

<v-jianyouquan></v-jianyouquan>部分

<template>
  <div class="main">
    <ul>
      <div class="guanzhu">全部关注
        <router-link to="/subscriptions/guanzhu">
          <a class="addguanzhu">
            添加关注
          </a>
        </router-link>
      </div>

      <router-link to="/subscriptions/timeline">
        <li class="beginhead">
              <img src="https://cdn2.jianshu.io/assets/web/jianyouquan-2fb0cd72e35147c79d6507c3a3a2591b.png">简友圈
        </li>
      </router-link>
      <li v-for="friends in friendList"><div class="l1"><img v-bind:src="friends.img">{{friends.title}}<a>{{friends.guanzhu}}</a></div></li>
    </ul>
  </div>
</template>

<script>
    export default {
        name: "jianyouquan",
      data() {
          return {
            friendList:[
              {
                "img":"https://upload.jianshu.io/collections/images/16/computer_guy.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/120/h/120/format/webp",
                "title":"程序员",
                "guanzhu":88
              },
              {
                "img":"https://upload.jianshu.io/collections/images/16/computer_guy.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/120/h/120/format/webp",
                "title":"程序员",
                "guanzhu":88
              },
              {
                "img":"https://upload.jianshu.io/collections/images/16/computer_guy.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/120/h/120/format/webp",
                "title":"程序员",
                "guanzhu":88
              },
              {
                "img":"https://upload.jianshu.io/collections/images/16/computer_guy.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/120/h/120/format/webp",
                "title":"程序员",
                "guanzhu":88
              },
              {
                "img":"https://upload.jianshu.io/collections/images/16/computer_guy.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/120/h/120/format/webp",
                "title":"程序员",
                "guanzhu":88
              },
              {
                "img":"https://upload.jianshu.io/collections/images/16/computer_guy.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/120/h/120/format/webp",
                "title":"程序员",
                "guanzhu":88
              },{
                "img":"https://upload.jianshu.io/collections/images/16/computer_guy.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/120/h/120/format/webp",
                "title":"程序员",
                "guanzhu":88
              },
              {
                "img":"https://upload.jianshu.io/collections/images/16/computer_guy.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/120/h/120/format/webp",
                "title":"程序员",
                "guanzhu":88
              },
              {
                "img":"https://upload.jianshu.io/collections/images/16/computer_guy.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/120/h/120/format/webp",
                "title":"程序员",
                "guanzhu":88
              }
            ]
          }
      }
    }
</script>

<style scoped>
  img {
    width: 40px;
    height: 40px;
    border-radius: 5px;
  }
  li {
    list-style-type: none;
    height: 60px;
    cursor: pointer;
    margin-top: 5px;
  }
  li:hover {
    background: gainsboro;
  }
  a {
    margin-left: 100px;
    text-decoration: none;
  }
  a:link {
    color: black;
  }
  .addguanzhu {
    margin-left: 5px;
    cursor: pointer;
  }
  .addguanzhu:link {
    color: black;
  }
  .beginhead {
    border-top-style: solid;
    border-top-color: gainsboro;
    margin-bottom: -20px;
  }
  .guanzhu {
    height: auto;
  }
  ul {
    height: 550px;
    width: 300px;
    overflow-y: scroll;
  }
  .main {
    margin-top: 50px;
  }

</style>
  • 消息页面


    消息.png
<template>
    <div class="container">
      <ul class="col-md-4">
          <li>
            <router-link to="/notifications/comments">
            <div class="1">
              <img src="../../../static/img/评论.png">
              <a class="info">评论</a>
            </div>
            </router-link>
          </li>

        <router-link to="/notifications/jianxin">
          <li>
            <img src="../../../static/img/信息.png">
            <a>简信</a>
          </li>
        </router-link>
        <li>
          <img src="../../../static/img/上传-互动.png">
          <a>投稿请求</a>
        </li>
        <li>
          <img src="../../../static/img/喜欢.png">
          <a>喜欢和赞</a>
        </li>
        <li>
          <img src="../../../static/img/已关注.png">
          <a>关注</a>
        </li>
        <li>
          <img src="../../../static/img/钱.png">
          <a>赞赏和付费</a>
        </li>
        <li>
          <img src="../../../static/img/更多.png">
          <a>其它提醒</a>
        </li>
      </ul>
      <div class="col-md-8">
        <router-view>

        </router-view>
      </div>
    </div>
</template>

<script>
    export default {
        name: "Notifications"
    }
</script>

<style scoped>
  .col-md-4 {
    list-style-type: none;
    float: left;
  }
  li {
    cursor: pointer;
    width: 263.2px;
    height: 50.71px;
    border-radius: 5px;
  }
  li:hover {
    background: gainsboro;
  }
  .container {
    margin-top: 50px;
    display: inline-block;
  }
  a {
    /*margin-left: 10px;*/
    list-style-type: none;
  }
  a:hover {
    text-decoration: none;
  }
  a:link {
    color: black;
  }
  img {
    margin-top: 10px;
  }
  .col-md-8 {
    float: right;
  }
</style>

二级路由

{
          //消息组件
          path: '/notifications',
          component: resolve => require(['../components/page/Notifications.vue'], resolve),
          meta: {title: '消息'},
          children: [
            {
              path: '/notifications/comments',
              component: Comments,
              meta: {title: '收到的评论'}
            },
            {
              path: '/notifications/jianxin',
              component: Jianxin,
              meta: {title: '简信'}
            }
          ]
        },

更多代码请见我的GitHub

https://github.com/1094064939/JianshuFrontEnd

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 用两张图告诉你,为什么你的 App 会卡顿? - Android - 掘金 Cover 有什么料? 从这篇文章中你...
    hw1212阅读 14,466评论 2 59
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 175,046评论 25 709
  • 一年一度的春节已经过去,如果把结婚,生子忽略,人生有很多的机会去追逐梦想。
    岔路ko阅读 2,823评论 0 0
  • 情绪是可以传染的,人们很自然会格外注意领导者的情绪和行为。因此,通常集体的领导者会奠定集体的基调,创造集...
    洁思漫讲阅读 4,262评论 0 2
  • 下次一起來,手牽手,湖邊坐,就願從此有你一生走……
    帶風走路deFENG阅读 937评论 0 1