feat(runtime-core): add watchEffect API
BREAKING CHANGE: replae `watch(fn, options?)` with `watchEffect`
The `watch(fn, options?)` signature has been replaced by the new
`watchEffect` API, which has the same usage and behavior. `watch`
now only supports the `watch(source, cb, options?)` signautre.
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const { createApp, ref, watch } = Vue
|
||||
const { createApp, ref, watchEffect } = Vue
|
||||
const API_URL = `https://api.github.com/repos/vuejs/vue-next/commits?per_page=3&sha=`
|
||||
|
||||
const truncate = v => {
|
||||
@@ -37,7 +37,7 @@ createApp({
|
||||
const currentBranch = ref('master')
|
||||
const commits = ref(null)
|
||||
|
||||
watch(() => {
|
||||
watchEffect(() => {
|
||||
fetch(`${API_URL}${currentBranch.value}`)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
|
||||
Reference in New Issue
Block a user