Skip to content

Commit fa5472a

Browse files
Add usage examples for Asset Options (#283)
* Add usage examples for Asset Options * Update src/api/options-assets.md Co-authored-by: Natalia Tepluhina <[email protected]> * Update src/api/options-assets.md Co-authored-by: Natalia Tepluhina <[email protected]> Co-authored-by: Natalia Tepluhina <[email protected]>
1 parent cdc142d commit fa5472a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/api/options-assets.md

+30
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@
88

99
A hash of directives to be made available to the component instance.
1010

11+
- **Usage:**
12+
```js
13+
const app = Vue.createApp({})
14+
15+
app.component('focused-input', {
16+
directives: {
17+
focus: {
18+
mounted(el) {
19+
el.focus()
20+
}
21+
}
22+
},
23+
template: `<input v-focus>`
24+
})
25+
```
26+
1127
- **See also:** [Custom Directives](../guide/custom-directive.html)
1228

1329
## components
@@ -18,4 +34,18 @@
1834

1935
A hash of components to be made available to the component instance.
2036

37+
- **Usage:**
38+
```js
39+
const Foo = {
40+
template: `<div>Foo</div>`
41+
}
42+
43+
const app = Vue.createApp({
44+
components: {
45+
Foo
46+
},
47+
template: `<Foo />`
48+
})
49+
```
50+
2151
- **See also:** [Components](../guide/component-basics.html)

0 commit comments

Comments
 (0)