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;
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
add a comment |
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
add a comment |
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
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
vue.js
asked Mar 23 at 20:36
zerohedgezerohedge
542522
542522
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
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>
I ended up doing something different, but this should work. Thanks.
– zerohedge
Mar 24 at 10:39
add a comment |
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.
This hides thepinitially, something I'm not interested in.
– zerohedge
Mar 24 at 10:39
add a comment |
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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>
I ended up doing something different, but this should work. Thanks.
– zerohedge
Mar 24 at 10:39
add a comment |
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>
I ended up doing something different, but this should work. Thanks.
– zerohedge
Mar 24 at 10:39
add a comment |
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>
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>
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
add a comment |
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
add a comment |
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.
This hides thepinitially, something I'm not interested in.
– zerohedge
Mar 24 at 10:39
add a comment |
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.
This hides thepinitially, something I'm not interested in.
– zerohedge
Mar 24 at 10:39
add a comment |
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.
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.
answered Mar 23 at 23:43
Decade MoonDecade Moon
14.8k32958
14.8k32958
This hides thepinitially, something I'm not interested in.
– zerohedge
Mar 24 at 10:39
add a comment |
This hides thepinitially, 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
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Apr 3 at 4:47
zerohedgezerohedge
542522
542522
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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