如何查看当前数据集是否为"dirty"?
How do I check if the current data set is "dirty"?
如何检查当前数据集是否脏?
我想在发布数据之前快速检查一下。以下面的代码片段为例:
save: function(e) {
if(~~insert dirty check here~~) {
$.ajax(e.currentTarget.action, {
type: this.method,
data: {
_method: this.method,
_token: this.token,
data: JSON.stringify(this.card_data)
}
}).done($.proxy(function(content) {
this.card_data = content;
this.mode = 'view';
}, this));
}
}
似乎 Vue.js 没有使用任何脏检查。
Vue.js is able to deliver the plain JavaScript object syntax without resorting to dirty checking by using Object.defineProperty, which is an ECMAScript 5 feature. It only works on DOM elements in IE8 and there's no way to polyfill it for JavaScript objects.
来源:https://github.com/vuejs/vue/wiki/FAQ
Vue.js has better performance because it doesn't use dirty checking.
来源:https://github.com/vuejs/vue/issues/96#issuecomment-35052704
如何检查当前数据集是否脏?
我想在发布数据之前快速检查一下。以下面的代码片段为例:
save: function(e) {
if(~~insert dirty check here~~) {
$.ajax(e.currentTarget.action, {
type: this.method,
data: {
_method: this.method,
_token: this.token,
data: JSON.stringify(this.card_data)
}
}).done($.proxy(function(content) {
this.card_data = content;
this.mode = 'view';
}, this));
}
}
似乎 Vue.js 没有使用任何脏检查。
Vue.js is able to deliver the plain JavaScript object syntax without resorting to dirty checking by using Object.defineProperty, which is an ECMAScript 5 feature. It only works on DOM elements in IE8 and there's no way to polyfill it for JavaScript objects.
来源:https://github.com/vuejs/vue/wiki/FAQ
Vue.js has better performance because it doesn't use dirty checking.
来源:https://github.com/vuejs/vue/issues/96#issuecomment-35052704