Skip to content

Commit 034e51f

Browse files
committed
fix(core): default value of prop inoperative
1 parent cd21dc4 commit 034e51f

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

packages/core/src/wc-class.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,24 +124,24 @@ export class JwcComponent extends HTMLElement implements JwcElement {
124124
const { attr: name, default: defaultValue } = prop;
125125
if (attrs[name]) {
126126
this.previousProps[name] = attrs[name];
127-
this.props[name] = attrs[name];
127+
this[name] = attrs[name];
128128
} else {
129129
this.previousProps[name] = defaultValue;
130-
this.props[name] = defaultValue;
130+
this[name] = defaultValue;
131131
}
132132
});
133133
}
134134

135135
private init() {
136136
this.props = this.getMetaList(COMPONENT_PROP_METADATA_KEY) || [];
137-
const propsList: PropOptions[] = Object.values(this.props);
137+
this.propsList = Object.values(this.props);
138138
const that = this;
139139
// define the default value of the props.
140-
propsList.forEach((prop: PropOptions) => {
140+
this.propsList.forEach((prop: PropOptions) => {
141141
const { attr: name, default: defaultValue } = prop;
142142
this.previousProps[name] = defaultValue;
143143
// getAttribute
144-
this.props[name] = defaultValue;
144+
this[name] = defaultValue;
145145
defineProxy(that, name, prop);
146146
});
147147
this.initWatcher();
@@ -201,10 +201,7 @@ export class JwcComponent extends HTMLElement implements JwcElement {
201201
this.$lastRender = removeAttrs(rendered);
202202
}
203203

204-
public disconnectedCallback() {
205-
this.$options.isMounted = false;
206-
this.rootNode && this.rootNode.remove();
207-
}
204+
public disconnectedCallback() {}
208205

209206
public attributeChangedCallback(
210207
name: string,

0 commit comments

Comments
 (0)