You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/guide/extras/web-components.md
+25-1Lines changed: 25 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ We consider Vue and Web Components to be primarily complementary technologies. V
6
6
7
7
## Using Custom Elements in Vue
8
8
9
-
Vue [scores a perfect 100% in the Custom Elements Everywhere tests](https://custom-elements-everywhere.com/libraries/vue/results/results.html). Consuming custom elements inside a Vue application largely works the same as using native HTML elements, with a few things to keep in mind:
9
+
Consuming custom elements inside a Vue application largely works the same as using native HTML elements, with a few things to keep in mind:
10
10
11
11
### Skipping Component Resolution
12
12
@@ -75,6 +75,30 @@ However, there could be rare cases where the data must be passed as a DOM proper
The `v-on` directive handles lowercase and kebab-case events dispatched from custom elements. However, the `v-on` directive does not support listening for events whose names include capital letters. For example, adding `v-on:myInput` to a custom element adds a listener for events with the name `my-input`, which does not handle an event with the name `myInput`.
81
+
82
+
If your app uses custom elements that dispatch events with capital letters, you can use a custom directive to add the correct event listener to the element.
83
+
84
+
#### Example Custom Directive to Handle Specific Events
The primary benefit of custom elements is that they can be used with any framework, or even without a framework. This makes them ideal for distributing components where the end consumer may not be using the same frontend stack, or when you want to insulate the end application from the implementation details of the components it uses.
0 commit comments