Skip to content

Commit e7e6d58

Browse files
committed
update closing transition
1 parent 5358d2c commit e7e6d58

File tree

3 files changed

+41
-22
lines changed

3 files changed

+41
-22
lines changed

examples/example.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="example">
3-
<VueLoadingButton @click.native="handleClick" :loading="isLoading" />
3+
<VueLoadingButton class="button" @click.native="handleClick" :loading="isLoading" />
44
</div>
55
</template>
66

@@ -29,4 +29,7 @@ export default {
2929
.example {
3030
font-family: sans-serif;
3131
}
32+
.button {
33+
background-color: coral;
34+
}
3235
</style>

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-loading-button",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "",
55
"license": "MIT",
66
"main": "dist/vue-loading-button.umd.js",
@@ -10,7 +10,6 @@
1010
"./sfc": "src/vue-loading-button.vue"
1111
},
1212
"scripts": {
13-
"dev": "vue serve ./src/vue-loading-button.vue",
1413
"example": "vue serve ./examples/example.vue",
1514
"build": "npm run build:unpkg & npm run build:es & npm run build:umd",
1615
"build:umd": "rollup --config build/rollup.config.js --format umd --file dist/vue-loading-button.umd.js",

src/vue-loading-button.vue

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
required: false,
88
default: false
99
},
10-
},
10+
}
1111
};
1212
</script>
1313

@@ -54,9 +54,9 @@ export default {
5454
border: solid 1px transparent;
5555
border-radius: 4px;
5656
cursor: pointer;
57-
padding: 8px 14px;
58-
line-height: 28px;
59-
font-size: 20px;
57+
padding: 8px 16px;
58+
line-height: 1.9rem;
59+
font-size: 1.4rem;
6060
position: relative;
6161
-webkit-transition: all 0.2s;
6262
transition: all 0.2s;
@@ -69,14 +69,14 @@ export default {
6969
0 0 0 1.5px lightblue;
7070
}
7171
.vue-loading-button:not(.loading) {
72-
transition-delay: 0.3s;
72+
transition-delay: 0.2s;
7373
}
74-
.vue-loading-button > .spinner {
74+
.spinner {
7575
line-height: 1.15;
7676
position: absolute;
7777
top: 50%;
7878
left: auto;
79-
right: 1.2em;
79+
right: 1.28em;
8080
margin: -0.5em;
8181
-webkit-transition: all 0.2s;
8282
transition: all 0.2s;
@@ -87,29 +87,46 @@ export default {
8787
display: inline-block;
8888
position: absolute;
8989
right: 0;
90-
width: 20px;
91-
height: 20px;
90+
width: 1.2rem;
91+
height: 1.2rem;
9292
opacity: 0;
93-
border: 4px solid #fff;
93+
border: 3.4px solid #fff;
9494
border-radius: 50%;
9595
animation: spinner 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
9696
border-color: #fff transparent transparent transparent;
97-
-webkit-transition: opacity 0.3s;
98-
transition: opacity 0.3s;
97+
-webkit-transition: opacity 0.2s;
98+
transition: opacity 0.2s;
9999
transition-timing-function: ease;
100-
transition-delay: 0.2s;
101100
}
102-
.vue-loading-button:not(.loading) .spinner span {
103-
transition-delay: 0s;
101+
.spinner span {
102+
transition-delay: 0.2s;
104103
}
105104
.spinner span:nth-child(1) {
106-
animation-delay: -0.45s;
105+
animation-delay: 0.45s;
107106
}
108107
.spinner span:nth-child(2) {
109-
animation-delay: -0.3s;
108+
animation-delay: 0.3s;
110109
}
111110
.spinner span:nth-child(3) {
112-
animation-delay: -0.15s;
111+
animation-delay: 0.15s;
112+
}
113+
.vue-loading-button:not(.loading) .spinner span {
114+
box-shadow: 0 0 0 .2rem rgba(255, 255, 255, 1);
115+
border: 10.4px solid #fff;
116+
-webkit-transition: all 0.4s;
117+
transition: all 0.4s;
118+
}
119+
.vue-loading-button:not(.loading) .spinner span:nth-child(1) {
120+
transform: rotate(0deg) !important;
121+
}
122+
.vue-loading-button:not(.loading) .spinner span:nth-child(2) {
123+
transform: rotate(90deg) !important;
124+
}
125+
.vue-loading-button:not(.loading) .spinner span:nth-child(3) {
126+
transform: rotate(180deg) !important;
127+
}
128+
.vue-loading-button:not(.loading) .spinner span:nth-child(4) {
129+
transform: rotate(270deg) !important;
113130
}
114131
@keyframes spinner {
115132
0% {
@@ -120,7 +137,7 @@ export default {
120137
}
121138
}
122139
.loading {
123-
padding-right: 2.5em;
140+
padding-right: 2.3em;
124141
}
125142
.loading .spinner span {
126143
opacity: 1;

0 commit comments

Comments
 (0)