watch
與export default
>在Vue中進行export default
>中導出vue component並不會影響watch
>選項的功能或語法。 無論您使用watch
>還是命名的導出,export default
>選項的工作原理完全相同。 export default
語法只是從文件中導出單個默認組件的一種便捷方法。
watch
>export default
> watch
watch: { myObject: { handler: function (newValue, oldValue) { // ... }, deep: true // this is expensive! } }
watch: { 'myObject.propertyA': { handler: function (newValue, oldValue) { // ... } }, 'myObject.propertyB': { handler: function (newValue, oldValue) { // ... } } }
deep
deep
>考慮:immediate
watch
watch
> <> <> <> watch
debouncing/throttling的工作:
watch
watch
徹底測試您的watch
<🎜和每個處理程序的行為,以幫助理解和維護。 >以下是一個示例演示最佳實踐的示例:
watch: { myObject: { handler: function (newValue, oldValue) { // ... }, deep: true // this is expensive! } }
export default
? >? >? >? >? >? >? > watch
no的功能或偶像性,使用export default
>選項都相同工作。 出口方法的選擇純粹是一種風格或組織偏好。 watch
配置保持一致。 watch
以上是Vue中export default如何配置組件的watch的詳細內容。更多資訊請關注PHP中文網其他相關文章!