Skip to content
Snippets Groups Projects
Commit a66fe23c authored by Cliff Li's avatar Cliff Li
Browse files

Set defaultprops oninit

parent a18ecc63
1 merge request!32Polythene components
......@@ -8,13 +8,16 @@ ButtonCSS.addStyle('.blue-button', {
});
export default class ButtonComponent {
static view(vnode) {
const defaultProps = {
static oninit(vnode) {
this.defaultProps = {
className: 'blue-button',
element: 'button',
disabled: vnode.attrs.active === false,
label: 'Unnamed button',
};
return m(Button, { ...defaultProps, ...vnode.attrs });
}
static view(vnode) {
return m(Button, { ...this.defaultProps, ...vnode.attrs });
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment