update loading spinner

This commit is contained in:
Leopoldthecoder 2016-08-25 18:37:03 +08:00
parent 8c71f10092
commit 3e08c5db68
3 changed files with 62 additions and 11 deletions

View File

@ -1,3 +1,5 @@
import Spinner from './spinner';
require('./spinner.css');
exports.install = Vue => {
let insertDom = (parent, directive, binding) => {
if (!directive.domVisible) {
@ -36,18 +38,9 @@ exports.install = Vue => {
margin: '0'
};
el.spinner = document.createElement('img');
el.spinner.src = require('./loading-bubbles.svg');
el.spinner = (new Spinner()).el;
el.spinnerStyle = {
color: '#ddd',
height: '60px',
width: '60px',
position: 'absolute',
top: '50%',
left: '50%',
marginTop: '-30px',
marginLeft: '-30px',
zIndex: '10001'
position: 'absolute'
};
},

View File

@ -0,0 +1,44 @@
.el-loading-spinner {
height: 12px;
width: 60px;
top: 50%;
left: 50%;
font-size: 0;
text-align: center;
margin-top: -6px;
margin-left: -30px;
z-index: 10001;
}
.el-loading-bubble {
height: 12px;
width: 12px;
background-color: #fff;
margin: 0 3px;
border-radius: 50%;
display: inline-block;
animation: 1s cubic-bezier(.2,.68,.18,1.08) infinite both bubble-pulse;
}
.el-loading-bubble.bubble1 {
animation-delay: .16s;
}
.el-loading-bubble.bubble2 {
animation-delay: .32s;
}
.el-loading-bubble.bubble3 {
animation-delay: .48s;
}
@keyframes bubble-pulse {
0%, 80% {
transform: scale(1);
opacity: 1;
}
45% {
transform: scale(0);
opacity: 0;
}
}

View File

@ -0,0 +1,14 @@
class Spinner {
constructor() {
let spinner = document.createElement('div');
spinner.classList.add('el-loading-spinner');
[1, 2, 3].forEach(index => {
let bubble = document.createElement('div');
bubble.classList.add('el-loading-bubble', `bubble${ index }`);
spinner.appendChild(bubble);
});
this.el = spinner;
}
}
export default Spinner;