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