Skip to content
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

docs: translate /guide/components/v-model #920

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/guide/components/v-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ function emitValue(e) {

<div class="options-api">

Modifiers added to a component `v-model` will be provided to the component via the `modelModifiers` prop. In the below example, we have created a component that contains a `modelModifiers` prop that defaults to an empty object:
添加到组件的 `v-model` 的修饰符将通过 `modelModifiers` 属性提供给组件。在下面的示例中,我们创建了一个包含 `modelModifiers` 属性的组件,该属性默认为空对象:
wxsms marked this conversation as resolved.
Show resolved Hide resolved

```vue{11}
<script>
Expand All @@ -471,9 +471,9 @@ export default {
</template>
```

Notice the component's `modelModifiers` prop contains `capitalize` and its value is `true` - due to it being set on the `v-model` binding `v-model.capitalize="myText"`.
请注意,组件的 `modelModifiers` 属性包含 `capitalize`,值为 `true` ——因为它是在 `v-model` 绑定的 `v-model.capitalize="myText"` 上设置的。
wxsms marked this conversation as resolved.
Show resolved Hide resolved

Now that we have our prop set up, we can check the `modelModifiers` object keys and write a handler to change the emitted value. In the code below we will capitalize the string whenever the `<input />` element fires an `input` event.
现在我们已经为组件配置了 prop,我们可以检查 `modelModifiers` 对象键并编写一个处理程序来更改发出的值。 在下面的代码中,每当 `<input />` 元素触发 `input` 事件时,我们都会将字符串大写。
wxsms marked this conversation as resolved.
Show resolved Hide resolved

```vue{13-15}
<script>
Expand Down