Skip to content

Commit

Permalink
[fix]
Browse files Browse the repository at this point in the history
  • Loading branch information
木瓜丸 committed Dec 20, 2020
1 parent 7bc0b05 commit 521da95
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ export class Component extends HTMLElement{
await this.dispatch('init');
if(this.afterFirstUpdate) this.afterFirstUpdate();
}
attr(key, default_value = undefined) {
return this.hasAttribute(key) ? this.getAttribute(key) : default_value;
}
prop(key, default_value = undefined) {
return this[key] ? this[key] : default_value;
}
init() {
return {};
}
updatecontext(state){
return {...state}
}
Expand Down

0 comments on commit 521da95

Please sign in to comment.