Browse Source

Pull request #3642: 无JIRA fix调用相关的先放在compact里面,不然会循环引用

Merge in VISUAL/fineui from ~DAILER/fineui:master to master

* commit '67d98c3b7c6a0e8f96ac125bf13ec33797d798d6':
  无JIRA fix调用相关的先放在compact里面,不然会循环引用
research/test
Dailer-刘荣歆 1 year ago
parent
commit
4b979987eb
  1. 25
      packages/fineui/src/core/4.widget.js
  2. 21
      packages/fineui/src/fix/fix.compact.js

25
packages/fineui/src/core/4.widget.js

@ -25,7 +25,7 @@ import {
import { OB } from "./3.ob";
import { Providers, _lazyCreateWidget } from "./5.inject";
import { DOM } from "./utils";
import { Events, emptyFn, pixFormat } from "./constant";
import { Events, pixFormat } from "./constant";
import { Plugin } from "./6.plugin";
import { _global } from "./0.foundation";
import { SystemProvider } from "./system";
@ -336,29 +336,6 @@ export class Widget extends OB {
}
}
__watch(getter, handler, options) {
if (_global.Fix) {
this._watchers = this._watchers || [];
const watcher = new Fix.Watcher(
null,
() => getter.call(this, this),
(handler &&
((v) => {
handler.call(this, this, v);
})) ||
emptyFn,
extend({ deep: true }, options)
);
this._watchers.push(() => {
watcher.teardown();
});
return watcher.value;
} else {
return getter();
}
}
/**
* 初始化根节点
* @private

21
packages/fineui/src/fix/fix.compact.js

@ -7,7 +7,7 @@ import {
extend,
isFunction,
Widget,
Providers
Providers, emptyFn
} from "@/core";
import { Fix } from "./fix";
@ -213,6 +213,25 @@ Widget.prototype.__destroy = function () {
delete this.__cacheStore;
};
Widget.prototype.__watch = function(getter, handler, options) {
this._watchers = this._watchers || [];
const watcher = new Fix.Watcher(
null,
() => getter.call(this, this),
(handler &&
((v) => {
handler.call(this, this, v);
})) ||
emptyFn,
extend({ deep: true }, options)
);
this._watchers.push(() => {
watcher.teardown();
});
return watcher.value;
};
_.each(["_render", "__afterRender", "_mount", "__afterMount"], (name) => {
const old = Widget.prototype[name];
old &&

Loading…
Cancel
Save