Commit b88f42eb62f67c533a56331435263323016de9be

Authored by 梁灏
1 parent 9084eb18

Button add 4 new type

Button add 4 new type
assets/iview.png

159 KB | W: | H:

158 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
src/components/button/button.vue
... ... @@ -17,7 +17,7 @@
17 17 props: {
18 18 type: {
19 19 validator (value) {
20   - return oneOf(value, ['primary', 'ghost', 'dashed', 'text']);
  20 + return oneOf(value, ['primary', 'ghost', 'dashed', 'text', 'info', 'success', 'warning', 'error']);
21 21 }
22 22 },
23 23 shape: {
... ...
src/styles/components/button.less
... ... @@ -46,6 +46,22 @@
46 46 .btn-text;
47 47 }
48 48  
  49 + &-success {
  50 + .btn-color(@success-color);
  51 + }
  52 +
  53 + &-warning {
  54 + .btn-color(@warning-color);
  55 + }
  56 +
  57 + &-error {
  58 + .btn-color(@error-color);
  59 + }
  60 +
  61 + &-info {
  62 + .btn-color(@info-color);
  63 + }
  64 +
49 65 //&-dashed {
50 66 // .btn-dashed;
51 67 //}
... ...
src/styles/mixins/button.less
... ... @@ -248,6 +248,18 @@
248 248 }
249 249 }
250 250  
  251 +// Color
  252 +.btn-color(@color) {
  253 + .button-variant(@btn-primary-color; @color; @color);
  254 +
  255 + &:hover,
  256 + //&:focus,
  257 + &:active,
  258 + &.active {
  259 + color: @btn-primary-color;
  260 + }
  261 +}
  262 +
251 263 // Circle for Icon
252 264 .btn-circle(@btnClassName: ivu-btn) {
253 265 border-radius: @btn-circle-size;
... ...
test/routers/button.vue
1 1 <template>
2 2 <h4>基本</h4>
3 3 <br><br>
  4 + <i-button type="success">按钮</i-button>
  5 + <i-button type="warning">按钮</i-button>
  6 + <i-button type="error">按钮</i-button>
  7 + <i-button type="info">按钮</i-button>
  8 + <br><br>
4 9 <Button-group>
5 10 <i-button>取消</i-button>
6 11 <i-button type="primary">确定</i-button>
... ...