vue實(shí)現(xiàn)跳轉(zhuǎn)接口push 轉(zhuǎn)場(chǎng)動(dòng)畫(huà)示例
1.index.js 配置子路由children。
import Vue from 'vue' import Router from 'vue-router' import SingerDetail from 'components/singer-detail/singer-detail'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
redirect: '/recommend'
},
{
path: '/singer',
component: Singer,
//配置子路由,加一個(gè)參數(shù)children
children: [
{
//:id 以id為變量,傳遞一個(gè)參數(shù),跳轉(zhuǎn)到不同子路由
path: ':id',
component: SingerDetail
}
]
},
{
path: '/search',
component: Search,
children: [
{
path: ':id',
component: SingerDetail
}
]
}
]
})
1.Singer
<template> <div class='singer'> <list-view @select='selectSinger'></list-view> //需要用routeview承載子路由 <router-view></router-view> </div> </template>
<script>
import listView from '../components/listview'
export default{
methods:{
selectSinger(singer){
//vue編程式跳轉(zhuǎn)接口push
this.$router.push({
path:'/singer/'+singer.id
})
}
},
components:{
listView
}
}
</script>
<style>
.singer{
}
</style>
2.listview (singer子組件)
<template> <div class='listview'> <ul> <li @click='selectItem(item)'></li> </ul> </div> </template>
<script>
export default{
methods:{
//內(nèi)部把點(diǎn)擊事件派發(fā)出去,告訴外部我被點(diǎn)擊
selectItem(item){
this.$emit('select',item);
}
}
}
</script>
<style>
.listview{
}
</style>
3.singerDetail
<template> <transition name='slide'> <div class='singer-detail'></div> </transition> </template>
<script> </script>
<style>
.singer-detail{
position:fixed
z-index:100
top:0
left:0
right:0
bottom:0
background:lightgray
}
.slider-enter-active,.slider-leave-active{
transition: all 0.3s
}
.slider-enter,.slider-leave-to{
transform: translate3d(100%,0,0)
}
</style>
4.push轉(zhuǎn)場(chǎng)動(dòng)畫(huà)
<transition name="slide"> <div class="chatdiv"> <div class="back" @click="backAction"></div> <div class="cont">免費(fèi)咨詢(xún)專(zhuān)業(yè)醫(yī)生在線解答</div> </div> </transition>
<style>
.slide-enter-active,.slide-leave-active{
transition: all 0.3s;
}
.slide-enter,.slide-leave-to{
transform: translate3d(100%,0,0);
}
</style>
以上這篇vue實(shí)現(xiàn)跳轉(zhuǎn)接口push 轉(zhuǎn)場(chǎng)動(dòng)畫(huà)示例就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
- Vue頁(yè)面跳轉(zhuǎn)動(dòng)畫(huà)效果的實(shí)現(xiàn)方法
- VUE單頁(yè)面切換動(dòng)畫(huà)代碼(全網(wǎng)最好的切換效果)
- 使用vue-router切換頁(yè)面時(shí)實(shí)現(xiàn)設(shè)置過(guò)渡動(dòng)畫(huà)
- vue-router之實(shí)現(xiàn)導(dǎo)航切換過(guò)渡動(dòng)畫(huà)效果
- vue中組件的過(guò)渡動(dòng)畫(huà)及實(shí)現(xiàn)代碼
- vue router自動(dòng)判斷左右翻頁(yè)轉(zhuǎn)場(chǎng)動(dòng)畫(huà)效果
相關(guān)文章
vue實(shí)現(xiàn)行列轉(zhuǎn)換的一種方法
這篇文章主要介紹了vue實(shí)現(xiàn)行列轉(zhuǎn)換的一種方法,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-08-08
vue 添加和編輯用同一個(gè)表單,el-form表單提交后清空表單數(shù)據(jù)操作
這篇文章主要介紹了vue 添加和編輯用同一個(gè)表單,el-form表單提交后清空表單數(shù)據(jù)操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-08-08
vue :style設(shè)置背景圖片方式backgroundImage
這篇文章主要介紹了vue :style設(shè)置背景圖片方式backgroundImage,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-10-10
詳解element上傳組件before-remove鉤子問(wèn)題解決
這篇文章主要介紹了詳解element上傳組件before-remove鉤子問(wèn)題解決,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-04-04
Vue?privide?和inject?依賴(lài)注入的使用詳解
這篇文章主要介紹了Vue?privide?和inject?依賴(lài)注入的用法,本文通過(guò)示例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-10-10
基于vue+element實(shí)現(xiàn)全局loading過(guò)程詳解
這篇文章主要介紹了基于vue+element實(shí)現(xiàn)全局loading過(guò)程詳解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-07-07

