Commit 518c639ada3332204e71c342c9eb8f4e05a1daf3

Authored by 梁灏
1 parent 4434b3ab

Revert "update Button & style"

This reverts commit 4434b3abfbbe97f38c8ccd61e8c5664f1b1120b7.
src/components/button/button.vue
... ... @@ -3,7 +3,9 @@
3 3 :type="htmlType"
4 4 :class="classes"
5 5 :disabled="disabled"
6   - @click="handleClick">
  6 + @blur="handleBlur"
  7 + @click="handleClick"
  8 + @focus="handleFocus">
7 9 <Icon class="ivu-load-loop" type="load-c" v-if="loading"></Icon>
8 10 <Icon :type="icon" v-if="icon && !loading"></Icon>
9 11 <span v-if="showSlot" ref="slot"><slot></slot></span>
... ... @@ -50,6 +52,7 @@
50 52 },
51 53 data () {
52 54 return {
  55 + isFocused: false,
53 56 showSlot: true
54 57 };
55 58 },
... ... @@ -63,15 +66,22 @@
63 66 [`${prefixCls}-${this.shape}`]: !!this.shape,
64 67 [`${prefixCls}-${this.size}`]: !!this.size,
65 68 [`${prefixCls}-loading`]: this.loading != null && this.loading,
66   - [`${prefixCls}-icon-only`]: !this.showSlot && (!!this.icon || this.loading)
  69 + [`${prefixCls}-icon-only`]: !this.showSlot && (!!this.icon || this.loading),
  70 + [`${prefixCls}-focused`]: this.isFocused
67 71 }
68 72 ];
69 73 }
70 74 },
71 75 methods: {
  76 + handleBlur () {
  77 + this.isFocused = false;
  78 + },
72 79 handleClick (event) {
73 80 this.$emit('click', event);
74   - }
  81 + },
  82 + handleFocus () {
  83 + this.isFocused = true;
  84 + },
75 85 },
76 86 mounted () {
77 87 this.showSlot = this.$slots.default !== undefined;
... ...
src/styles/mixins/button.less
... ... @@ -135,7 +135,7 @@
135 135 .button-size(@btn-padding-base; @btn-font-size; @btn-border-radius);
136 136 //transform: translate3d(0, 0, 0);
137 137 //transition: all @transition-time linear;
138   - transition: color @transition-time linear, background-color @transition-time linear, border @transition-time linear, box-shadow @transition-time linear;
  138 + transition: color @transition-time linear, background-color @transition-time linear, border @transition-time linear;
139 139  
140 140 > .@{css-prefix-iconfont} {
141 141 line-height: 1;
... ... @@ -267,7 +267,9 @@
267 267 // Color
268 268 // for tabindex
269 269 .active-btn-color(@color) {
270   - &:focus {
  270 + transition: all @transition-time @ease-in-out;
  271 + &.@{btn-prefix-cls}-focused {
  272 +
271 273 box-shadow: 0 0 0 2px fade(@color, 20%);
272 274 z-index: 1;
273 275 }
... ...