mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
only apply button class for non item
This commit is contained in:
@ -30,10 +30,7 @@ import {Config} from '../../config/config';
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: 'button,[button]',
|
selector: 'button,[button]'
|
||||||
host: {
|
|
||||||
'class': 'button'
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
export class Button {
|
export class Button {
|
||||||
|
|
||||||
@ -50,10 +47,12 @@ export class Button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (element.hasAttribute('ion-item')) {
|
if (element.hasAttribute('ion-item')) {
|
||||||
// no need to put on these icon classes for an ion-item
|
// no need to put on these classes for an ion-item
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderer.setElementAttribute(elementRef, 'class', 'button');
|
||||||
|
|
||||||
if (type) {
|
if (type) {
|
||||||
renderer.setElementAttribute(elementRef, type, '');
|
renderer.setElementAttribute(elementRef, type, '');
|
||||||
}
|
}
|
||||||
@ -85,13 +84,13 @@ export class Button {
|
|||||||
|
|
||||||
if (nodes.length > 1) {
|
if (nodes.length > 1) {
|
||||||
if (nodes[0] === ICON && nodes[1] === TEXT) {
|
if (nodes[0] === ICON && nodes[1] === TEXT) {
|
||||||
element.classList.add('icon-left');
|
renderer.setElementClass(elementRef, 'icon-left', true);
|
||||||
|
|
||||||
} else if (nodes[0] === TEXT && nodes[1] === ICON) {
|
} else if (nodes[0] === TEXT && nodes[1] === ICON) {
|
||||||
element.classList.add('icon-right');
|
renderer.setElementClass(elementRef, 'icon-right', true);
|
||||||
}
|
}
|
||||||
} else if (nodes.length === 1 && nodes[0] === ICON) {
|
} else if (nodes.length === 1 && nodes[0] === ICON) {
|
||||||
element.classList.add('icon-only');
|
renderer.setElementClass(elementRef, 'icon-only', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user