Skip to content

Commit

Permalink
fix(ui/button): fix button block style to class
Browse files Browse the repository at this point in the history
affects: @varlet/ui
  • Loading branch information
haoziqaq committed May 19, 2021
1 parent a04588e commit 433633c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions packages/varlet-ui/src/button/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class="var-button var--box"
:class="[
`var-button--${size}`,
block ? 'var--flex' : 'var--inline-flex',
block ? 'var--flex var-button--block' : 'var--inline-flex',
disabled ? 'var-button--disabled' : null,
text ? `var-button--text-${type}` : `var-button--${type}`,
text ? 'var-button--text' : 'var-elevation--1',
Expand All @@ -15,7 +15,6 @@
:style="{
color: textColor,
background: color,
width: block ? '100%' : null,
}"
:disabled="disabled"
@click="handleClick"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ exports[`test button example 1`] = `
<!--v-if-->
<div class=\\"var-button__content\\">大型按钮</div>
</button>
<div class=\\"app-type\\">块级按钮</div><button class=\\"var-button var--box var-button--normal var--flex var-button--primary var-elevation--1\\" style=\\"width: 100%;\\">
<div class=\\"app-type\\">块级按钮</div><button class=\\"var-button var--box var-button--normal var--flex var-button--block var-button--primary var-elevation--1\\">
<!--v-if-->
<div class=\\"var-button__content\\">块级按钮</div>
</button>
Expand Down Expand Up @@ -155,7 +155,7 @@ exports[`test button example 1`] = `
`;
exports[`test button styles 1`] = `
"<button class=\\"var-button var--box var-button--large var--flex var-button--text-default var-button--text var-button--round\\" style=\\"width: 100%;\\">
"<button class=\\"var-button var--box var-button--large var--flex var-button--block var-button--text-default var-button--text var-button--round\\">
<!--v-if-->
<div class=\\"var-button__content\\">button text</div>
</button>"
Expand Down
4 changes: 4 additions & 0 deletions packages/varlet-ui/src/button/button.less
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
box-shadow: none !important;
}

&--block {
width: 100%;
}

&--text {
background-color: transparent;

Expand Down

0 comments on commit 433633c

Please sign in to comment.