mirror of
https://github.com/flarum/core.git
synced 2025-08-04 07:27:39 +02:00
Fix Button component not working because of attrs.children being frozen
This commit is contained in:
@@ -32,10 +32,7 @@ export interface ButtonProps extends ComponentProps {
|
||||
*/
|
||||
export default class Button<T extends ButtonProps = ButtonProps> extends Component<T> {
|
||||
view(vnode) {
|
||||
const attrs: ButtonProps = vnode.attrs;
|
||||
const children = attrs.children;
|
||||
|
||||
delete attrs.children;
|
||||
const { children, ...attrs} = vnode.attrs;
|
||||
|
||||
attrs.className = attrs.className || '';
|
||||
attrs.type = attrs.type || 'button';
|
||||
@@ -50,7 +47,7 @@ export default class Button<T extends ButtonProps = ButtonProps> extends Compone
|
||||
|
||||
const loading = extract(attrs, 'loading');
|
||||
if (attrs.disabled || loading) {
|
||||
attrs.className += ' disabled' + (loading ? ' loading' : '');
|
||||
attrs.className += ' ' + classNames('disabled', loading && 'loading');
|
||||
delete attrs.onclick;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user