Skip to content

Commit

Permalink
improve compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhan committed Aug 24, 2022
1 parent 5f5708e commit 6dfd8d3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions index.js
Expand Up @@ -49,16 +49,18 @@ function componentInitLifeCycle() {
if (hooks) {
let len = hooks.length;
this[lifeCycle] = function (...args) {
for (let i = 0; i < len; i++) {
hooks[i].apply(this, args);
if (this.__scContext) {
for (let i = 0; i < len; i++) {
hooks[i].apply(this, args);
}
}
};
}
});
}

function componentInitComputed() {
let computed = this.__scContext.computed;
let computed = this.__scContext && this.__scContext.computed;
if (computed) {
let names = Object.keys(computed);
for (let i = 0; i < names.length; i++) {
Expand All @@ -80,7 +82,7 @@ function componentInitComputed() {
}

function componentInitWatch() {
let watches = this.__scContext.watches;
let watches = this.__scContext && this.__scContext.watches;
if (watches) {
let component = this.__scContext.component;

Expand Down

0 comments on commit 6dfd8d3

Please sign in to comment.