Comments (4)
I like the idea, but i think it would be a bit tricky since we don't have access to any information about event handlers using emits and can't really wait for it to resolve. (For example here: https://github.com/nuxt/ui/blob/dev/src/runtime/components/forms/Form.vue#L136).
The only solution I can think of is to replace the @submit
/ @click
events by a prop with a callback function, but it feels a bit odd.
A dedicated composable maybe? Something like useAsyncData
except in only returns a handle to execute the function and the loading state?
const { loading, execute: submit } = useLoading(async () => { /* ... */ })
from ui.
This can be achieved using VueUse's useAsyncState
(https://vueuse.org/core/useAsyncState/) to wrap your event handlers:
const { isReady, execute } = useAsyncState(async () => {
// ...
},
null,
{ immediate: false },
)
from ui.
I found out that we can declare emits using props while exploring ways to implement this, so it's actually possible to do it without changing the way components are used 😄
Here's a sample implementation for v3:
https://github.com/benjamincanac/ui3/pull/135/files
from ui.
So cool 🤩
from ui.
Related Issues (20)
- Theming White Color Globally
- Is there any way to remove the textarea autoresize shift?
- InputMenu: monitor the popper size HOT 3
- Links not works in next prev arrows UPagination HOT 1
- Skeleton: as property HOT 1
- UForm: apply transformations from the validator
- Help slots for Checkbox, Radio and RadioGroup
- Can't adding Notification in composable HOT 2
- Notification description has zero margin top when title is specified
- How to pass ui props to UCard? HOT 2
- FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory HOT 1
- Accordion `items` type does not allow custom content HOT 1
- Setting color prop dynamically causes issues HOT 3
- after build “Cannot find module shiki” I use the template of "https://github.com/nuxt-ui-pro/saas.git" in Nuxt UI Pro HOT 2
- Strip all dark mode classes
- [Edge] SelectMenu: returns no results when using lazy search with custom #option slot HOT 1
- Add "to" and "href" props to Avatar component HOT 2
- input menu: show options when the input field was clicked HOT 2
- USelectMenu Label slot currently selected item with value-attribute
- Star rating HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui.