为什么报错了?提示Uncaught TypeError: delayedLeave is not a function

来源:4-5 过渡动画-css实现过渡(下)

Willsf

2017-09-13

//App.vue
<template>
  <div id="app">
    <img src="./assets/logo.png">
    <button v-on:click="toggleCom">
       Toggle
    </button>
    <div class="ab">
      <transition name="fade" mode="in-out">
        <!--<p v-show="show">i am show</p>-->
        <div :is="currentVue" v-show="show" ></div>
      </transition>

    </div>
  </div>
</template>

<script>
import Hello from './components/Hello'
import Apple from "./components/apples"
import Banana from "./components/bananas"
export default {
   data(){
     return {
         show:true,
          currentVue:Apple
     }
   },
  name: 'app',
  components: {
    Hello,
    Apple,
    Banana
  },
  computed:{
    totalPrice(){
      return this.$store.state.totalPrice
    }
  },
  methods:{
    toggleCom:function () {
      if(this.currentVue==='Apple'){
        this.currentVue='Banana'
      }else{
        this.currentVue='Apple'
      }
    }
  }
}
</script>

<style>
  .fade-enter-active,.fade-leave-active{
    transition: all 1.5s;
  }
  .fade-enter{
    transform: translateX(500px);
    opacity: 0;
  }
  .fade-leave-active{
    transform: translateX(-500px);
      opacity: 0;
  }
</style>

//banans,apple.vue
<template>
  <div>
      <h1>{{msg}}</h1>
      <button>+</button>
  </div>
</template>
<script>
  export default{
    data(){
      return {
          msg:"i am apples",
          price:5
      }
    },
</script>
写回答

2回答

fishenal

2017-09-14

全局搜搜delayedLeave吧,Hello组件里有没有,transition去掉试试,也有可能是这个默认组件里报错

0
2
fishenal
回复
Willsf
那应该是是transition组件内部的问题
2017-09-18
共2条回复

Willsf

提问者

2017-09-13

//szimg.mukewang.com/59b947c80001b43210770401.jpg错误截图

0
0

最容易上手的Vue2.0入门实战教程

快速入门Vue2.0,组件化开发一个数字产品电商平台

3966 学习 · 999 问题

查看课程