A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuejs/vue/issues/5983 below:

Improved API for UI components, reducing boilerplate for forwarding attributes and events · Issue #5983 · vuejs/vue · GitHub

What problem does this feature solve?

There are many cases where attributes passed to a Vue component should not be added to the root element, but rather a sub-element. For example, in this UI component, an incredible amount of props must be used to ensure that attributes are added to the input element, instead of the wrapper div.

Additionally, it's often desirable to expose all event listeners on a form element to the parent, which also requires a lot of boilerplate currently if the element is not the root (in which case, the .native modifier can solve the problem).

What does the proposed API look like?

EDIT: Start here to catch up on the discussion.

Currently by default, the "exposed" element (the one that arbitrary attributes can be added to) is always the root element. A new directive could be used to define a different exposed element. Some ideas for the name of the directive:

If v-expose is added to an element, it will accept attributes passed to its component - and these attributes will no longer be passed to the root element.

Other features that may be nice:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4