Vue 2 ConfigList Property: Immediate, Handler, and Deep Watching
This\scode\sis\sdefining\sa\sconfigList\sproperty\sin\sa\sVue\s2\scomponent.\n\nThe\sconfigList\sproperty\sis\san\sobject\sthat\shas\sthree\skeys:\n\n1.\simmediate:\sThis\skey\sis\sset\sto\strue\s,which\smeans\sthat\sthe\shandler\sfunction\swill\sbe\scalled\simmediately\swhen\sthe\scomponent\sis\screated.\n\n2.\shandler:\sThis\skey\sis\sa\sfunction\sthat\swill\sbe\scalled\swhenever\sthe\sconfigList\sproperty\sis\supdated.\sThe\snewItems\sparameter\sin\sthe\sfunction\srepresents\sthe\snew\svalue\sof\sthe\sconfigList\sproperty.\n\n3.\sdeep:\sThis\skey\sis\sset\sto\strue\s,which\smeans\sthat\sthe\shandler\sfunction\swill\salso\sbe\scalled\sif\sany\snested\sproperties\sof\sthe\sconfigList\sobject\sare\smodified.\n\nIn\sthis\scase\s,the\shandler\sfunction\ssimply\sprints\sthe\snewItems\svalue\sto\sthe\sconsole.
原文地址: https://www.cveoy.top/t/topic/mCaw 著作权归作者所有。请勿转载和采集!