VueJS: Enable transition only after FIRST loadVue transition mode on on-demand components not workingWatching in vue cann't work in some caseInitialize data in Vue Component from vuex api requestUse Vuex to connect many new VueBinding localstorage and vuex respectivelyVueJS - Render all components after async call API are done and all dom is loadhow to use vue transitions to only show page when loaded?Vue component doesn´t rerender after vuex state changeTrigger event only once within transition-groupOn which window / document event should a component be initialized?

Is it safe to redirect stdout and stderr to the same file without file descriptor copies?

can conjure barrage stack with martial adept- disarming or tripping attack?

How to make Flex Markers appear in Logic Pro X?

Why is this integration method not valid?

Why is 'additive' EQ more difficult to use than 'subtractive'?

What is this dime sized black bug with white on the segments near Loveland Colorodao?

Can a UK national work as a paid shop assistant in the USA?

How to safely discharge oneself

What to call a small, open stone or cement reservoir that supplies fresh water from a spring or other natural source?

(For training purposes) Are there any openings with rook pawns that are more effective than others (and if so, what are they)?

Why is this python script running in background consuming 100 % CPU?

Must every right-inverse of a linear transformation be a linear transformation?

Does the fact that we can only measure the two-way speed of light undermine the axiom of invariance?

How would a physicist explain this starship engine?

Does science define life as "beginning at conception"?

Three knights or knaves, three different hair colors

How do I write real-world stories separate from my country of origin?

What pc resources are used when bruteforcing?

Why is Ni[(PPh₃)₂Cl₂] tetrahedral?

Real Analysis: Proof of the equivalent definitions of the derivative.

Is my company merging branches wrong?

How do you earn the reader's trust?

Find this Unique UVC Palindrome ( ignoring signs and decimal) from Given Fractional Relationship

Is the default 512 byte physical sector size appropriate for SSD disks under Linux?



VueJS: Enable transition only after FIRST load


Vue transition mode on on-demand components not workingWatching in vue cann't work in some caseInitialize data in Vue Component from vuex api requestUse Vuex to connect many new VueBinding localstorage and vuex respectivelyVueJS - Render all components after async call API are done and all dom is loadhow to use vue transitions to only show page when loaded?Vue component doesn´t rerender after vuex state changeTrigger event only once within transition-groupOn which window / document event should a component be initialized?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I've got this line in my vue component:



<p><b>You have <transition name="fade" mode="out-in"><span :key="todos_counter">todos_counter</span></transition> items</b></p>


The problem seems to be, because todos_counter is coming from vuex store using MapGetters, its real initial value is 0, but then on the initial load it update to (say) 16, so Vue applied the transition on the initial page-load. I only want a transition if todos_counter changed AFTER the first load.



So basically I want the initial load to not include ANY transition, but if after the initial component load is completed todos_counter changes, I do want the transition to occur.



This is really tricky, even using watch on the component level is hard because from the watcher's perspective todos_count DOES change on the first page load.










share|improve this question




























    0















    I've got this line in my vue component:



    <p><b>You have <transition name="fade" mode="out-in"><span :key="todos_counter">todos_counter</span></transition> items</b></p>


    The problem seems to be, because todos_counter is coming from vuex store using MapGetters, its real initial value is 0, but then on the initial load it update to (say) 16, so Vue applied the transition on the initial page-load. I only want a transition if todos_counter changed AFTER the first load.



    So basically I want the initial load to not include ANY transition, but if after the initial component load is completed todos_counter changes, I do want the transition to occur.



    This is really tricky, even using watch on the component level is hard because from the watcher's perspective todos_count DOES change on the first page load.










    share|improve this question
























      0












      0








      0








      I've got this line in my vue component:



      <p><b>You have <transition name="fade" mode="out-in"><span :key="todos_counter">todos_counter</span></transition> items</b></p>


      The problem seems to be, because todos_counter is coming from vuex store using MapGetters, its real initial value is 0, but then on the initial load it update to (say) 16, so Vue applied the transition on the initial page-load. I only want a transition if todos_counter changed AFTER the first load.



      So basically I want the initial load to not include ANY transition, but if after the initial component load is completed todos_counter changes, I do want the transition to occur.



      This is really tricky, even using watch on the component level is hard because from the watcher's perspective todos_count DOES change on the first page load.










      share|improve this question














      I've got this line in my vue component:



      <p><b>You have <transition name="fade" mode="out-in"><span :key="todos_counter">todos_counter</span></transition> items</b></p>


      The problem seems to be, because todos_counter is coming from vuex store using MapGetters, its real initial value is 0, but then on the initial load it update to (say) 16, so Vue applied the transition on the initial page-load. I only want a transition if todos_counter changed AFTER the first load.



      So basically I want the initial load to not include ANY transition, but if after the initial component load is completed todos_counter changes, I do want the transition to occur.



      This is really tricky, even using watch on the component level is hard because from the watcher's perspective todos_count DOES change on the first page load.







      vue.js






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 23 at 20:36









      zerohedgezerohedge

      542522




      542522






















          3 Answers
          3






          active

          oldest

          votes


















          1














          Try this, hopefully it should work God willing.



          In your template:



          <p>
          <b>
          You have
          <!-- Added duration prop here -->
          <transition
          name="fade"
          mode="out-in"
          :duration="transitionDuration"
          >
          <span
          :key="todos_counter"
          >
          todos_counter
          </span>
          </transition>
          items
          </b>
          </p>


          In your script:



          <script>
          export default
          data()
          return
          // this is as if there is no transition, it's way too fast.
          transitionDuration: "1ms"
          ;
          ,
          mounted()
          setTimeout(() =>
          // this will set the duration back to normal after the initial render.
          this.transitionDuration = "1000ms"
          , 100)


          <script>





          share|improve this answer























          • I ended up doing something different, but this should work. Thanks.

            – zerohedge
            Mar 24 at 10:39



















          0














          You really need a way of determining when the data is loading so you can control the transition. Right now the value is initially rendered as 0 and then after loading it changes to 16, so the transition will play.



          You can try something like this:



          <p v-if="!loading">
          <b>You have <transition name="fade" mode="out-in"><span :key="todos_counter">todos_counter</span></transition> items</b>
          </p>


          computed: 
          ...mapState(['loading']),
          ...mapGetters(['todos_counter']),



          loading must be initially true, then after the initial load it is set to false.



          It doesn't have to be exactly like this, but you get the idea.






          share|improve this answer























          • This hides the p initially, something I'm not interested in.

            – zerohedge
            Mar 24 at 10:39


















          0














          This is the approach I went with:



          HTML:



          <p><b>You have <transition v-bind:name="animateOn" mode="out-in"><span :key="todos_counter">todos_counter</span></transition> items</b></p>


          JS:



           data: () => (
          animateOn: "none",
          updatedBefore: false,
          ),

          watch: {
          todos_counter()
          if (!this.updatedBefore)
          this.updatedBefore = true

          else
          this.animateOn = "fade"




          Bind the transition name to animateOn (initial value: "none"), and then when the todo_counter changes, change this value to "fade". This way the element isn't animated on the first load.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55318124%2fvuejs-enable-transition-only-after-first-load%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Try this, hopefully it should work God willing.



            In your template:



            <p>
            <b>
            You have
            <!-- Added duration prop here -->
            <transition
            name="fade"
            mode="out-in"
            :duration="transitionDuration"
            >
            <span
            :key="todos_counter"
            >
            todos_counter
            </span>
            </transition>
            items
            </b>
            </p>


            In your script:



            <script>
            export default
            data()
            return
            // this is as if there is no transition, it's way too fast.
            transitionDuration: "1ms"
            ;
            ,
            mounted()
            setTimeout(() =>
            // this will set the duration back to normal after the initial render.
            this.transitionDuration = "1000ms"
            , 100)


            <script>





            share|improve this answer























            • I ended up doing something different, but this should work. Thanks.

              – zerohedge
              Mar 24 at 10:39
















            1














            Try this, hopefully it should work God willing.



            In your template:



            <p>
            <b>
            You have
            <!-- Added duration prop here -->
            <transition
            name="fade"
            mode="out-in"
            :duration="transitionDuration"
            >
            <span
            :key="todos_counter"
            >
            todos_counter
            </span>
            </transition>
            items
            </b>
            </p>


            In your script:



            <script>
            export default
            data()
            return
            // this is as if there is no transition, it's way too fast.
            transitionDuration: "1ms"
            ;
            ,
            mounted()
            setTimeout(() =>
            // this will set the duration back to normal after the initial render.
            this.transitionDuration = "1000ms"
            , 100)


            <script>





            share|improve this answer























            • I ended up doing something different, but this should work. Thanks.

              – zerohedge
              Mar 24 at 10:39














            1












            1








            1







            Try this, hopefully it should work God willing.



            In your template:



            <p>
            <b>
            You have
            <!-- Added duration prop here -->
            <transition
            name="fade"
            mode="out-in"
            :duration="transitionDuration"
            >
            <span
            :key="todos_counter"
            >
            todos_counter
            </span>
            </transition>
            items
            </b>
            </p>


            In your script:



            <script>
            export default
            data()
            return
            // this is as if there is no transition, it's way too fast.
            transitionDuration: "1ms"
            ;
            ,
            mounted()
            setTimeout(() =>
            // this will set the duration back to normal after the initial render.
            this.transitionDuration = "1000ms"
            , 100)


            <script>





            share|improve this answer













            Try this, hopefully it should work God willing.



            In your template:



            <p>
            <b>
            You have
            <!-- Added duration prop here -->
            <transition
            name="fade"
            mode="out-in"
            :duration="transitionDuration"
            >
            <span
            :key="todos_counter"
            >
            todos_counter
            </span>
            </transition>
            items
            </b>
            </p>


            In your script:



            <script>
            export default
            data()
            return
            // this is as if there is no transition, it's way too fast.
            transitionDuration: "1ms"
            ;
            ,
            mounted()
            setTimeout(() =>
            // this will set the duration back to normal after the initial render.
            this.transitionDuration = "1000ms"
            , 100)


            <script>






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 23 at 22:34









            Hamada Fadil MahdiHamada Fadil Mahdi

            514




            514












            • I ended up doing something different, but this should work. Thanks.

              – zerohedge
              Mar 24 at 10:39


















            • I ended up doing something different, but this should work. Thanks.

              – zerohedge
              Mar 24 at 10:39

















            I ended up doing something different, but this should work. Thanks.

            – zerohedge
            Mar 24 at 10:39






            I ended up doing something different, but this should work. Thanks.

            – zerohedge
            Mar 24 at 10:39














            0














            You really need a way of determining when the data is loading so you can control the transition. Right now the value is initially rendered as 0 and then after loading it changes to 16, so the transition will play.



            You can try something like this:



            <p v-if="!loading">
            <b>You have <transition name="fade" mode="out-in"><span :key="todos_counter">todos_counter</span></transition> items</b>
            </p>


            computed: 
            ...mapState(['loading']),
            ...mapGetters(['todos_counter']),



            loading must be initially true, then after the initial load it is set to false.



            It doesn't have to be exactly like this, but you get the idea.






            share|improve this answer























            • This hides the p initially, something I'm not interested in.

              – zerohedge
              Mar 24 at 10:39















            0














            You really need a way of determining when the data is loading so you can control the transition. Right now the value is initially rendered as 0 and then after loading it changes to 16, so the transition will play.



            You can try something like this:



            <p v-if="!loading">
            <b>You have <transition name="fade" mode="out-in"><span :key="todos_counter">todos_counter</span></transition> items</b>
            </p>


            computed: 
            ...mapState(['loading']),
            ...mapGetters(['todos_counter']),



            loading must be initially true, then after the initial load it is set to false.



            It doesn't have to be exactly like this, but you get the idea.






            share|improve this answer























            • This hides the p initially, something I'm not interested in.

              – zerohedge
              Mar 24 at 10:39













            0












            0








            0







            You really need a way of determining when the data is loading so you can control the transition. Right now the value is initially rendered as 0 and then after loading it changes to 16, so the transition will play.



            You can try something like this:



            <p v-if="!loading">
            <b>You have <transition name="fade" mode="out-in"><span :key="todos_counter">todos_counter</span></transition> items</b>
            </p>


            computed: 
            ...mapState(['loading']),
            ...mapGetters(['todos_counter']),



            loading must be initially true, then after the initial load it is set to false.



            It doesn't have to be exactly like this, but you get the idea.






            share|improve this answer













            You really need a way of determining when the data is loading so you can control the transition. Right now the value is initially rendered as 0 and then after loading it changes to 16, so the transition will play.



            You can try something like this:



            <p v-if="!loading">
            <b>You have <transition name="fade" mode="out-in"><span :key="todos_counter">todos_counter</span></transition> items</b>
            </p>


            computed: 
            ...mapState(['loading']),
            ...mapGetters(['todos_counter']),



            loading must be initially true, then after the initial load it is set to false.



            It doesn't have to be exactly like this, but you get the idea.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 23 at 23:43









            Decade MoonDecade Moon

            14.8k32958




            14.8k32958












            • This hides the p initially, something I'm not interested in.

              – zerohedge
              Mar 24 at 10:39

















            • This hides the p initially, something I'm not interested in.

              – zerohedge
              Mar 24 at 10:39
















            This hides the p initially, something I'm not interested in.

            – zerohedge
            Mar 24 at 10:39





            This hides the p initially, something I'm not interested in.

            – zerohedge
            Mar 24 at 10:39











            0














            This is the approach I went with:



            HTML:



            <p><b>You have <transition v-bind:name="animateOn" mode="out-in"><span :key="todos_counter">todos_counter</span></transition> items</b></p>


            JS:



             data: () => (
            animateOn: "none",
            updatedBefore: false,
            ),

            watch: {
            todos_counter()
            if (!this.updatedBefore)
            this.updatedBefore = true

            else
            this.animateOn = "fade"




            Bind the transition name to animateOn (initial value: "none"), and then when the todo_counter changes, change this value to "fade". This way the element isn't animated on the first load.






            share|improve this answer



























              0














              This is the approach I went with:



              HTML:



              <p><b>You have <transition v-bind:name="animateOn" mode="out-in"><span :key="todos_counter">todos_counter</span></transition> items</b></p>


              JS:



               data: () => (
              animateOn: "none",
              updatedBefore: false,
              ),

              watch: {
              todos_counter()
              if (!this.updatedBefore)
              this.updatedBefore = true

              else
              this.animateOn = "fade"




              Bind the transition name to animateOn (initial value: "none"), and then when the todo_counter changes, change this value to "fade". This way the element isn't animated on the first load.






              share|improve this answer

























                0












                0








                0







                This is the approach I went with:



                HTML:



                <p><b>You have <transition v-bind:name="animateOn" mode="out-in"><span :key="todos_counter">todos_counter</span></transition> items</b></p>


                JS:



                 data: () => (
                animateOn: "none",
                updatedBefore: false,
                ),

                watch: {
                todos_counter()
                if (!this.updatedBefore)
                this.updatedBefore = true

                else
                this.animateOn = "fade"




                Bind the transition name to animateOn (initial value: "none"), and then when the todo_counter changes, change this value to "fade". This way the element isn't animated on the first load.






                share|improve this answer













                This is the approach I went with:



                HTML:



                <p><b>You have <transition v-bind:name="animateOn" mode="out-in"><span :key="todos_counter">todos_counter</span></transition> items</b></p>


                JS:



                 data: () => (
                animateOn: "none",
                updatedBefore: false,
                ),

                watch: {
                todos_counter()
                if (!this.updatedBefore)
                this.updatedBefore = true

                else
                this.animateOn = "fade"




                Bind the transition name to animateOn (initial value: "none"), and then when the todo_counter changes, change this value to "fade". This way the element isn't animated on the first load.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 3 at 4:47









                zerohedgezerohedge

                542522




                542522



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55318124%2fvuejs-enable-transition-only-after-first-load%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해