-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(reactive): update translated docs
- Loading branch information
Showing
3 changed files
with
59 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
``` |