matvaleriano / vue-countup-directive

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

oldvalue is not defined

djave-co opened this issue · comments

commented

Hi there, I know you're probably fed up seeing this issue, but I'm having the same problem as some others with my Nuxt project.

client.js?06a0:76 ReferenceError: oldvalue is not defined
    at eval (index.js?5b2e:13)
    at componentUpdated (index.js?5b2e:13)
    at callHook$1 (vue.runtime.esm.js?2b0e:6680)
    at eval (vue.runtime.esm.js?2b0e:6632)
    at wrappedHook (vue.runtime.esm.js?2b0e:2235)
    at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
    at invoker (vue.runtime.esm.js?2b0e:2175)
    at patchVnode (vue.runtime.esm.js?2b0e:6335)
    at updateChildren (vue.runtime.esm.js?2b0e:6193)
    at patchVnode (vue.runtime.esm.js?2b0e:6319)

Reproduction
I'm using the latest (I think – ^1.2.3) version of vue-countup-directive and Yarn.

If it helps, I made a repo which has the error:
https://github.com/EightArmsWebmaster/vue-countup-oldvalue

Setup
I setup the plugin file like so:

import Vue from 'vue'
import options from 'vue-countup-directive'

Vue.directive('countUp', options)

And then reference it:

plugins: [
  { src: '~plugins/countUp.js', ssr: false }
],

How I implemented it...
None of these setups work:

<span :class="active ? 'active': ''" v-countUp:onClassChange.once="{ startValue: 0, endValue: 120, expectedClass: 'active', options: { duration: 1 } }"></span>
<span :class="{ active : active }" v-countUp:onClassChange.once="{ startValue: 0, endValue: 120, expectedClass: 'active', options: { duration: 1 } }"></span>
<span :class="getActiveClass()" v-countUp:onClassChange.once="{ startValue: 0, endValue: 120, expectedClass: 'active', options: { duration: 1 } }"></span>

Possible solution
I'm not sure if this is the problem, but it seems like in the /src/index.js all references refer to oldValue, but in the /dist/index.js there is a mixture of oldvalue and oldValue. I tried changing them in the built, index.js but it didn't work correctly...

Have the same issue here with nuxt.

commented

sorry people... i'll not maintain anymore this project because i don't have any time to do this 😞

commented

@mathvaleriano no worries, thanks for letting me know.

@surfgreendev I have made a tiny component here that does much of this, without CountUp. Not sure if it is any use to you.
https://github.com/djave-co/vue-counter/blob/master/Counter.vue