Skip to content

Commit bb78180

Browse files
Merge branch 'master' of github.com:vuejs/docs-next
2 parents edf61f8 + 238422b commit bb78180

File tree

5 files changed

+31
-35
lines changed

5 files changed

+31
-35
lines changed

src/.vuepress/components/community/team/members.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,16 @@ const members = [
299299
twitter: 'KiaKing85',
300300
reposOfficial: ['vuex'],
301301
reposPersonal: ['vuex-orm/*']
302+
},
303+
{
304+
name: 'Anthony Fu',
305+
city: 'Taipei, Taiwan',
306+
languages: ['zh', 'en'],
307+
github: 'antfu',
308+
twitter: 'antfu7',
309+
reposOfficial: ['composition-api'],
310+
reposPersonal: ['vueuse', 'vue-demi', 'vue-reactivity/*'],
311+
links: ['https://antfu.me/']
302312
}
303313
])
304314
)

src/guide/composition-api-template-refs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Template Refs
1+
# Template Refs
22

33
> This section uses [single-file component](single-file-component.html) syntax for code examples
44
@@ -35,7 +35,7 @@ Here we are exposing `root` on the render context and binding it to the div as i
3535

3636
Refs used as templates refs behave just like any other refs: they are reactive and can be passed into (or returned from) composition functions.
3737

38-
### Usage with JSX
38+
## Usage with JSX
3939

4040
```js
4141
export default {
@@ -53,7 +53,7 @@ export default {
5353
}
5454
```
5555

56-
### Usage inside `v-for`
56+
## Usage inside `v-for`
5757

5858
Composition API template refs do not have special handling when used inside `v-for`. Instead, use function refs to perform custom handling:
5959

src/guide/custom-directive.md

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -209,40 +209,22 @@ app.directive('demo', (el, binding) => {
209209

210210
## Usage on Components
211211

212-
In 3.0, with fragments support, components can potentially have more than one root nodes. This creates an issue when a custom directive is used on a component with multiple root nodes.
213-
214-
To explain the details of how custom directives will work on components in 3.0, we need to first understand how custom directives are compiled in 3.0. For a directive like this:
212+
When used on components, custom directive will always apply to component's root node, similarly to [non-prop attributes](component-attrs.html).
215213

216214
```vue-html
217-
<div v-demo="test"></div>
218-
```
219-
220-
Will roughly compile into this:
221-
222-
```js
223-
const vDemo = resolveDirective('demo')
224-
225-
return withDirectives(h('div'), [[vDemo, test]])
215+
<my-component v-demo="test"></my-component>
226216
```
227217

228-
Where `vDemo` will be the directive object written by the user, which contains hooks like `mounted` and `updated`.
229-
230-
`withDirectives` returns a cloned VNode with the user hooks wrapped and injected as VNode lifecycle hooks (see [Render Function](render-function.html) for more details):
231-
232218
```js
233-
{
234-
onVnodeMounted(vnode) {
235-
// call vDemo.mounted(...)
236-
}
237-
}
219+
app.component('my-component', {
220+
template: `
221+
<div> // v-demo directive will be applied here
222+
<span>My component content</span>
223+
</div>
224+
`
225+
})
238226
```
239227

240-
**As a result, custom directives are fully included as part of a VNode's data. When a custom directive is used on a component, these `onVnodeXXX` hooks are passed down to the component as extraneous props and end up in `this.$attrs`.**
241-
242-
This also means it's possible to directly hook into an element's lifecycle like this in the template, which can be handy when a custom directive is too involved:
243-
244-
```vue-html
245-
<div @vnodeMounted="myHook" />
246-
```
228+
Unlike attributes, directives can't be passed to a different element with `v-bind="$attrs"`.
247229

248-
This is consistent with the [attribute fallthrough behavior](component-attrs.html). So, the rule for custom directives on a component will be the same as other extraneous attributes: it is up to the child component to decide where and whether to apply it. When the child component uses `v-bind="$attrs"` on an inner element, it will apply any custom directives used on it as well.
230+
With [fragments](/guide/migration/fragments.html#overview) support, components can potentially have more than one root nodes. When applied to a multi-root component, directive will be ignored and the warning will be thrown.

src/guide/migration/introduction.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,7 @@ It is recommended to use [VSCode](https://code.visualstudio.com/) with our offic
192192
[rpv-badge]: https://img.shields.io/npm/v/rollup-plugin-vue/next.svg
193193
[rpv-npm]: https://www.npmjs.com/package/rollup-plugin-vue/v/next
194194
[rpv-code]: https://github.com/vuejs/rollup-plugin-vue/tree/next
195+
196+
::: info
197+
For additional information on Vue 3 compatibility with libraries and plugins, be sure to check out [this issue in awesome-vue](https://github.com/vuejs/awesome-vue/issues/3544).
198+
:::

src/guide/transitions-enterleave.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ We discuss [transitioning between components](#transitioning-between-components)
446446
</transition>
447447
```
448448

449-
It's actually possible to transition between any number of elements, either by using multiple `v-if`s or binding a single element to a dynamic property. For example:
449+
It's actually possible to transition between any number of elements, either by using `v-if`/`v-else-if`/`v-else` or binding a single element to a dynamic property. For example:
450450

451451
<!-- TODO: rewrite example and put in codepen example -->
452452

@@ -455,10 +455,10 @@ It's actually possible to transition between any number of elements, either by u
455455
<button v-if="docState === 'saved'" key="saved">
456456
Edit
457457
</button>
458-
<button v-if="docState === 'edited'" key="edited">
458+
<button v-else-if="docState === 'edited'" key="edited">
459459
Save
460460
</button>
461-
<button v-if="docState === 'editing'" key="editing">
461+
<button v-else-if="docState === 'editing'" key="editing">
462462
Cancel
463463
</button>
464464
</transition>

0 commit comments

Comments
 (0)