|
@@ -1,9 +1,39 @@
|
|
|
<template>
|
|
|
<div id="app">
|
|
|
- <router-view/>
|
|
|
+ <transition :name="transitionName">
|
|
|
+ <router-view></router-view>
|
|
|
+ </transition>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ name: "APP",
|
|
|
+ data() {
|
|
|
+ return { transitionName: "" };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ $route(to, from) {
|
|
|
+ const toDepth = to.path.split("/").length;
|
|
|
+ const fromDepth = from.path.split("/").length;
|
|
|
+ if (toDepth < fromDepth) {
|
|
|
+ this.transitionName = "slide-right";
|
|
|
+ } else if (toDepth > fromDepth) {
|
|
|
+ this.transitionName = "slide-left";
|
|
|
+ } else if (to.query.examQuestionId && from.query.examQuestionId) {
|
|
|
+ if (to.query.examQuestionId < from.query.examQuestionId) {
|
|
|
+ this.transitionName = "slide-right";
|
|
|
+ } else if (to.query.examQuestionId > from.query.examQuestionId) {
|
|
|
+ this.transitionName = "slide-left";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log("App: " + this.transitionName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+
|
|
|
<style>
|
|
|
#app {
|
|
|
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
|