-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with duration setting for animations in Vuejs #158
Comments
I'm having trouble reproducing this. I setup a new Vue 3 app: npm create vue@latest I added this to vue({
template: {
compilerOptions: {
isCustomElement: tag => tag.startsWith('wa-')
}
}
}), Imported WA in <link rel="stylesheet" href="https://early.webawesome.com/[email protected]/dist/styles/themes/default.css" />
<link rel="stylesheet" href="https://early.webawesome.com/[email protected]/dist/styles/native.css" />
<script type="module" src="https://early.webawesome.com/[email protected]/dist/webawesome.loader.js"></script> And added the following animation/button to <div class="wrapper">
<wa-animation name="bounce" duration="2000" iterations="3" play>
<wa-button variant="brand">Click me</wa-button>
</wa-animation>
</div> And it works: But I see nothing in the console. 🤔 I do however see this exact error if I set I'm wondering if that's also what you might be seeing. |
That's interesting. I cloned my project, ripped everything that's just noise to the issue and the issue still persisted. Just as I was wondering how I would share that code with you I tried copying your code from above and it just worked. That made me see the difference. You are importing WA via loader:
I am importing single WA components directly (because I had problems with WA components not being ready when Vuejs already wanted to access them – preloading the WA components solved this issue):
Could it be that |
Interestingly it seems indeed to be related to Vuejs (or at least the way it is composing html). If I put the whole example into a plain html file it also just works fine:
|
I spent some time trying to get this to work with no luck. I think it has something to do with the timing of when Vue mounts and the component registers. The good news is, this problem will go away once Web Awesome is on npm. Are you able to use the autoloader in the meantime? That seems to work consistently for me. |
Well, I just experienced the opposite with the autoloader. Not with this issue here, but with
When using the autoloader all checkboxes are toggled even though only one menu item should be checked: When preloading the components it behaves correctly: My assessment here was that the component is loaded too late via autoloader and Vue is not able to bind the values correctly as it does not know anything about the properties of the component. Or that initially it thinks this is plain HTML and when the component loads, it then all of a sudden has JS properties which might confuse Vue. I am looking forward to the NPM solution but my expectation was that importing the components from there would do exactly the same as what I am currently doing with cherry picking. So I don't expect any difference in behaviour there. I tried to check with the debugger in the browser how the values look like where the error occurs. It seems that both Interestingly, if I bind From the documentation on MDN (https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffect/KeyframeEffect#iterations) I saw that for An easy fix could simply be to cast duration to a number via |
PS: My current workaround is to just bind duration with |
Describe the bug
When setting the duration of an animation in Vuejs like in the following example it triggers an error:
When using v-bind to set the duration then it works as expected:
It seems that it is required for the duration to be an integer instead of a string. This may have something to do with Vuejs. BUT, the setting for iterations is not affected and can be set with v-bind or without. I could not pinpoint the problem as it seems that the component code of
<wa-animation>
does treat both properties the same.I'm using 3.0.0-alpha.9.
The text was updated successfully, but these errors were encountered: