vue.js 中的 ng-dirty 类似功能



我有一个包含 100 个字段的表单(有些嵌套如 v-model="a.b.c" 或 v-model="e.h.s.z"(。

想在 vue 中实现类似 ng-dirty(来自角度(的功能吗.js

不想按字段级别监视/检查字段。

你可以用一个深度观察者来尝试:

watch:
{
a:
{
handler(newValue, oldValue)
{
// find out what was actually changed
},
deep: true
},
e:
{
handler(newValue, oldValue)
{
// find out what was actually changed
},
deep: true
},
}

最新更新