JavaScript/vue.js/watch:修订间差异
来自康健生活
| 第33行: | 第33行: | ||
</script></syntaxhighlight> | </script></syntaxhighlight> | ||
=== onTrigger === | === onTrigger === | ||
=== watchEffect === | |||
<syntaxhighlight lang="html5"> | |||
<script> | |||
import { watchEffect } from 'vue' | |||
// ... | |||
setup() { | |||
watchEffect(() => { | |||
console.log('count changed to', count.value); | |||
}); | |||
// ... | |||
</script> | |||
</syntaxhighlight> | |||