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: docs/content/develop/step-2e.md
-134Lines changed: 0 additions & 134 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -180,140 +180,6 @@ The events object contains any custom events that this component will fire and f
180
180
}
181
181
```
182
182
183
-
## JavaScript
184
-
185
-
Looking back to our component's JavaScript, we can now add the schema to our web component by adding:
186
-
187
-
```
188
-
get schemaUrl() {
189
-
return "pfe-cool-element.json";
190
-
}
191
-
```
192
-
193
-
Adding the schema will allow the web component to read in these properties and enforce the schema settings automatically. Inside PFElement, we can see `_mapSchemaToProperties` and `_mapSchemaToSlots` methods. These methods read in the schema and check the web component mark-up for valid or invalid inputs. If an attribute is required but not provided, it will inject that attribute onto the component using the default value from the schema.
194
-
195
-
Additionally, it will validate the slots being used and add a `has_<slot-name>` attribute to the parent which can be used for styling purposes.
196
-
197
-
Let's look at our component with the schemaURL added:
198
-
199
-
200
-
```
201
-
import PFElement from "../pfelement/dist/pfelement.js";
0 commit comments