Skip to content

Commit

Permalink
docs(reactive): update translated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Jul 25, 2021
1 parent 6b839fa commit a403cd3
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/reactive/.umirc.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export default {
children: [
{
title: 'observer',
path: '/api/react/observer',
path: '/zh-CN/api/react/observer',
},
],
},
Expand All @@ -255,7 +255,7 @@ export default {
children: [
{
title: 'observer',
path: '/api/vue/observer',
path: '/zh-CN/api/vue/observer',
},
],
},
Expand Down
22 changes: 11 additions & 11 deletions packages/reactive/docs/api/vue/observer.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# observer

## 描述
## describe

Vue 中,将组件渲染方法变成 Reaction,每次视图重新渲染就会收集依赖,依赖更新会自动重渲染。
In Vue, the component rendering method is changed to Reaction, and dependencies are collected every time the view is re-rendered, and dependencies are updated automatically to re-render.

## 用例
## Example

```html
<template>
<div>
<div>
<input
:style="{
height: 28,
padding: '0 8px',
border: '2px solid #888',
borderRadius: 3,
}"
height: 28,
padding: '0 8px',
border: '2px solid #888',
borderRadius: 3,
}"
:value="obs.value"
@input="(e) => {
obs.value = e.target.value
}"
obs.value = e.target.value
}"
/>
</div>
<div>{{obs.value}}</div>
Expand All @@ -33,7 +33,7 @@
export default observer({
data() {
// 能与 vue 的响应系统共存
// can coexist with vue's response system
const obs = observable({
value: 'Hello world',
})
Expand Down
46 changes: 46 additions & 0 deletions packages/reactive/docs/api/vue/observer.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# observer

## 描述

在 Vue 中,将组件渲染方法变成 Reaction,每次视图重新渲染就会收集依赖,依赖更新会自动重渲染。

## 用例

```html
<template>
<div>
<div>
<input
:style="{
height: 28,
padding: '0 8px',
border: '2px solid #888',
borderRadius: 3,
}"
:value="obs.value"
@input="(e) => {
obs.value = e.target.value
}"
/>
</div>
<div>{{obs.value}}</div>
</div>
</template>

<script>
import { observable } from '@formily/reactive'
import { observer } from '@formily/reactive-vue'
export default observer({
data() {
// 能与 vue 的响应系统共存
const obs = observable({
value: 'Hello world',
})
return {
obs,
}
},
})
</script>
```

0 comments on commit a403cd3

Please sign in to comment.