Skip to content

Refine “Custom Directive” #589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 9, 2017

Conversation

Justineo
Copy link
Member

@Justineo Justineo commented Nov 8, 2017

一些翻译的修正、用词的调整。

@@ -6,7 +6,7 @@ order: 302

## 简介

除了默认设置的核心指令 (`v-model` 和 `v-show`),Vue 也允许注册自定义指令。注意,在 Vue2.0 里面,代码复用的主要形式和抽象是组件——然而,有的情况下,你仍然需要对纯 DOM 元素进行底层操作,这时候就会用到自定义指令。下面这个例子将聚焦一个 input 元素,像这样
除了核心功能默认内置的指令 (`v-model` 和 `v-show`),Vue 也允许注册自定义指令。注意,在 Vue2.0 中,代码复用和抽象的主要形式是组件。然而,有的情况下,你仍然需要对普通 DOM 元素进行底层操作,这时候就会用到自定义指令。其中一个例子是对一个输入元素进行聚焦操作,就像这样
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其中一个例子是对一个输入元素进行聚焦操作,就像这样
->
举个聚焦输入框的例子,如下

- `arg`:传给指令的参数,可选。例如 `v-my-directive:foo` 中,参数为 `"foo"`。
- `modifiers`:一个包含修饰符的对象。例如:`v-my-directive.foo.bar` 中,修饰符对象为 `{ foo: true, bar: true }`。
- `vnode`:Vue 编译生成的虚拟节点。移步 [VNode API](../api/#VNode-接口) 来了解更多详情
- `oldVnode`:上一个虚拟节点,仅在 `update` 和 `componentUpdated` 钩子中可用。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这部分修改同步到英文版吧

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

恩。

@Jinjiang Jinjiang merged commit 437ddb2 into vuejs:master Nov 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants