firstvue's People
Forkers
vincent-cong wellenzhong lee66 yst726 looknd suyucheng520 1514louluo geogie xxgo1992 cardsix lzcaat baitu-xw threeones cuihangjun likunpeng06 zhouzhizhen goodluck2016 linjianqiang hwxufo heheshang xiaodongzhida gitnoecn hongtu3333 ximiabc judyccc jinligen vacual marchrains 695643979 lewinbofirstvue's Issues
路由深度判断改写
前辈您好,学习了您的这个项目,受益良多,谢谢您。
我是这样处理main.js中的路由深度判断的,请您看看是否可取。
//调试信息输出:
// console.log('to.path : ' + to.path)
// console.log('to.path.length : ' + to.path.length)
// console.log('from.path : ' + from.path)
// console.log('from.path.length : ' + from.path.length)
/*特殊处理'/' 和 ‘’ 路由路径,
*如果处理到这两个路径,总是把它们当做最浅层的路径,把相应的depth记作0。
* 从而使得其他的所有路径,即使是同级的 '/detail' ,相应的depth为2, 也比这两个路径比较起来更深,以应用上正确的过渡动画。*/
const toDepth = ((to.path.length) <= 1) ? 0 : to.path.split('/').length
const fromDepth = ((from.path.length) <= 1) ? 0 : from.path.split('/').length
// 根据路由深度,来判断是该从右侧进入还是该从左侧进入
this.transitionName = toDepth < fromDepth ? 'slide_back' : 'slide'
可以的话,能允许我Pull一个request吗?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.