-
-
Notifications
You must be signed in to change notification settings - Fork 609
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
Vertical stepper's animation #3881
Comments
Thanks for reporting this issue, @StarDustEins! Minimum reproducible example: with ui.stepper().props('vertical animated') as stepper:
with ui.step('A'):
with ui.stepper_navigation():
ui.button('Next', on_click=stepper.next)
with ui.step('B'):
with ui.stepper_navigation():
ui.button('Next', on_click=stepper.next)
ui.button('Back', on_click=stepper.previous)
with ui.step('C'):
with ui.stepper_navigation():
ui.button('Back', on_click=stepper.previous) |
So far I failed to reproduce it with plain Quasar/Vue: <html>
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto:400|Material+Icons" rel="stylesheet" type="text/css" />
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/quasar.prod.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="q-app">
<q-stepper ref="stepper" :model-value="step" @update:model-value="onStepChange" vertical animated>
<q-step :name="1" title="Step 1">
<q-stepper-navigation>
<q-btn @click="next" label="Next"></q-btn>
</q-stepper-navigation>
</q-step>
<q-step :name="2" title="Step 2">
<q-stepper-navigation>
<q-btn @click="next" label="Next"></q-btn>
<q-btn @click="previous" label="Previous"></q-btn>
</q-stepper-navigation>
</q-step>
<q-step :name="3" title="Step 3">
<q-stepper-navigation>
<q-btn @click="previous" label="Previous"></q-btn>
</q-stepper-navigation>
</q-step>
</q-stepper>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/quasar.umd.prod.js"></script>
<script>
const app = Vue.createApp({
setup() {
const step = Vue.ref(1);
const stepper = Vue.ref(null);
return {
step,
stepper,
onStepChange: (newStep) => (step.value = newStep),
next: () => stepper.value.next(),
previous: () => stepper.value.previous(),
};
},
});
app.use(Quasar);
app.mount("#q-app");
</script>
</body>
</html> This animates as expected. But what's the difference to a NiceGUI app? Does anyone have an idea? |
I have no idea about Vue and js |
@falkoschindler I suspect the reason for the issue is that the stepper rebuilds all its child elements every time it updates |
I looked into this issue once again, but still don't understand why NiceGUI behaves differently than plain Quasar. @CrystalWindSnake might be right and Vue is recreating the QStep elements. But I don't see why, because NiceGUI is only calling |
NiceGUI not only calls In the following example, when you click from nicegui import ui
class MyStepper(ui.stepper):
def update(self) -> None:
print("updating stepper")
return super().update()
with MyStepper().props("vertical animated") as stepper:
with ui.step("A"):
with ui.stepper_navigation():
ui.button("Next", on_click=stepper.next)
with ui.step("B"):
with ui.stepper_navigation():
ui.button("Next", on_click=stepper.next)
ui.button("Back", on_click=stepper.previous)
with ui.step("C"):
with ui.stepper_navigation():
ui.button("Back", on_click=stepper.previous)
ui.run() |
Ah, I wasn't aware of It seems like calling with ui.element('q-stepper').props('model-value=A vertical animated') as stepper:
with ui.element('q-step').props('name=A title=A'):
ui.button('next', on_click=lambda: stepper.run_method('next'))
with ui.element('q-step').props('name=B title=B'):
ui.button('back', on_click=lambda: stepper.run_method('previous')) Only when subscribing to the with ui.element('q-stepper').props('model-value=A vertical animated') \
.on('update:model-value', lambda e: stepper.props(f'model-value={e.args}')) as stepper:
with ui.element('q-step').props('name=A title=A'):
ui.button('next', on_click=lambda: stepper.run_method('next'))
with ui.element('q-step').props('name=B title=B'):
ui.button('back', on_click=lambda: stepper.run_method('previous')) Now the question remains: What does |
Description
Vertical stepper's animation seems not good, in Quasor's official demo it works smoothly. I use the latest version of Nicegui 2.3.0
2024-10-16.13.28.09.mov
The text was updated successfully, but these errors were encountered: