zoukankan      html  css  js  c++  java
  • singer页面点击歌手singer是跳转到singer-detail的设置

    1.创建components/singer-detail/singer-detail.vue

    2.配置动态路由:

    1  {
    2           path: ':id',
    3           name:'singer-detail',
    4           component:()=>import('@/components/singer-detail/singer-detail.vue')
    5         }

    3.在listview.vue中emitselectSinger事件来触发选择明星,并将选择的明星item作为参数派发给singer.vue

    1  seletSinger(singerName){
    2         this.$emit('selectSinger',singerName)
    3       },

    4.singer中监听派发的selectsinger事件,并设置路由跳转;

    1   selectSinger(singerName){
    2           this.$router.push({
    3             path: `/singer/${singerName.id}`
    4           })
    5         },

    5.给singer.vue中添加<router-view></router-view>来显示子组件singer-detail.vue的内容;因为会将父子组件一起显示,为了只显示子组件,给singer-detail.vue添加样式:

    1 .singer-detail{
    2   position: fixed;
    3   z-index: 100;
    4   top: 0;
    5   left: 0;
    6   bottom: 0;
    7   right: 0;
    8   background: #222;
    9 }

     5.给在切换到歌手详情页的时候添加动画:在singer-detail.vue最外层包<transition></transition>并设置样式:

    1   .slide-enter-active, .slide-leave-active {
    2     transition: all 0.3s
    3 
    4   }
    5   .slide-enter, .slide-leave-to {
    6 
    7     transform: translate3d(100%, 0, 0)
    8   }
  • 相关阅读:
    银行业务调度系统
    交通灯管理系统
    Java高新技术
    Java反射机制
    java的集合框架
    正则表达式
    IPD CBB
    TCP的可靠传输(依赖流量控制、拥塞控制、连续ARQ)
    等价类划分
    Pycharm常用配置汇总
  • 原文地址:https://www.cnblogs.com/yangguoe/p/9458584.html
Copyright © 2011-2022 走看看