watch

默认情况,只在被监听的属性值发生变化时执行

options


immediate

可以在使用watch时,设置immediate:true。这样它就会在组件创建时立即执行。