Commit f97e5bb01ad9aa43431d73cc0a6c34afad9c95bb
1 parent
d9786906
support LoadingBar
support LoadingBar @Jetsly
Showing
7 changed files
with
71 additions
and
22 deletions
Show diff stats
CHANGE.md
README.md
examples/app.vue
| ... | ... | @@ -50,6 +50,7 @@ li + li { border-left: solid 1px #bbb; padding-left: 10px; margin-left: 10px; } |
| 50 | 50 | <li><router-link to="/date">Date</router-link></li> |
| 51 | 51 | <li><router-link to="/form">Form</router-link></li> |
| 52 | 52 | <li><router-link to="/table">Table</router-link></li> |
| 53 | + <li><router-link to="/loading-bar">LoadingBar</router-link></li> | |
| 53 | 54 | </ul> |
| 54 | 55 | </nav> |
| 55 | 56 | <router-view></router-view> | ... | ... |
examples/main.js
| 1 | +<template> | |
| 2 | + <div> | |
| 3 | + <i-button @click.native="start">Start</i-button> | |
| 4 | + <i-button @click.native="finish">Finish</i-button> | |
| 5 | + <i-button @click.native="error">Error</i-button> | |
| 6 | + </div> | |
| 7 | +</template> | |
| 8 | +<script> | |
| 9 | + export default { | |
| 10 | + methods: { | |
| 11 | + start () { | |
| 12 | + this.$Loading.start(); | |
| 13 | + }, | |
| 14 | + finish () { | |
| 15 | + this.$Loading.finish(); | |
| 16 | + }, | |
| 17 | + error () { | |
| 18 | + this.$Loading.error(); | |
| 19 | + } | |
| 20 | + }, | |
| 21 | + created () { | |
| 22 | + this.$Loading.config({ | |
| 23 | + color: '#5cb85c', | |
| 24 | + failedColor: '#f0ad4e', | |
| 25 | + height: 5 | |
| 26 | + }); | |
| 27 | + } | |
| 28 | + } | |
| 29 | +</script> | ... | ... |
src/components/loading-bar/loading-bar.vue
| 1 | 1 | <template> |
| 2 | - <div :class="classes" :style="outerStyles" v-show="show" transition="fade"> | |
| 3 | - <div :class="innerClasses" :style="styles"></div> | |
| 4 | - </div> | |
| 2 | + <transition name="fade"> | |
| 3 | + <div :class="classes" :style="outerStyles" v-show="show"> | |
| 4 | + <div :class="innerClasses" :style="styles"></div> | |
| 5 | + </div> | |
| 6 | + </transition> | |
| 5 | 7 | </template> |
| 6 | 8 | <script> |
| 7 | 9 | import { oneOf } from '../../utils/assist'; |
| ... | ... | @@ -10,10 +12,10 @@ |
| 10 | 12 | |
| 11 | 13 | export default { |
| 12 | 14 | props: { |
| 13 | - percent: { | |
| 14 | - type: Number, | |
| 15 | - default: 0 | |
| 16 | - }, | |
| 15 | +// percent: { | |
| 16 | +// type: Number, | |
| 17 | +// default: 0 | |
| 18 | +// }, | |
| 17 | 19 | color: { |
| 18 | 20 | type: String, |
| 19 | 21 | default: 'primary' |
| ... | ... | @@ -26,17 +28,27 @@ |
| 26 | 28 | type: Number, |
| 27 | 29 | default: 2 |
| 28 | 30 | }, |
| 29 | - status: { | |
| 30 | - type: String, | |
| 31 | - validator (value) { | |
| 32 | - return oneOf(value, ['success', 'error']); | |
| 33 | - }, | |
| 34 | - default: 'success' | |
| 35 | - }, | |
| 36 | - show: { | |
| 37 | - type: Boolean, | |
| 38 | - default: false | |
| 39 | - } | |
| 31 | +// status: { | |
| 32 | +// type: String, | |
| 33 | +// validator (value) { | |
| 34 | +// return oneOf(value, ['success', 'error']); | |
| 35 | +// }, | |
| 36 | +// default: 'success' | |
| 37 | +// }, | |
| 38 | +// show: { | |
| 39 | +// type: Boolean, | |
| 40 | +// default: false | |
| 41 | +// } | |
| 42 | + }, | |
| 43 | + data () { | |
| 44 | + return { | |
| 45 | + percent: 0, | |
| 46 | +// color: 'primary', | |
| 47 | +// failedColor: 'error', | |
| 48 | +// height: 2, | |
| 49 | + status: 'success', | |
| 50 | + show: false | |
| 51 | + }; | |
| 40 | 52 | }, |
| 41 | 53 | computed: { |
| 42 | 54 | classes () { | ... | ... |
src/index.js
| ... | ... | @@ -19,7 +19,7 @@ import Form from './components/form'; |
| 19 | 19 | import Icon from './components/icon'; |
| 20 | 20 | import Input from './components/input'; |
| 21 | 21 | import InputNumber from './components/input-number'; |
| 22 | -// import LoadingBar from './components/loading-bar'; | |
| 22 | +import LoadingBar from './components/loading-bar'; | |
| 23 | 23 | import Menu from './components/menu'; |
| 24 | 24 | // import Message from './components/message'; |
| 25 | 25 | // import Modal from './components/modal'; |
| ... | ... | @@ -75,7 +75,7 @@ const iview = { |
| 75 | 75 | // iInput: Input, |
| 76 | 76 | Input, |
| 77 | 77 | InputNumber, |
| 78 | - // LoadingBar, | |
| 78 | + LoadingBar, | |
| 79 | 79 | Menu, |
| 80 | 80 | MenuGroup: Menu.Group, |
| 81 | 81 | MenuItem: Menu.Item, |
| ... | ... | @@ -121,7 +121,7 @@ const install = function (Vue, opts = {}) { |
| 121 | 121 | Vue.component(key, iview[key]); |
| 122 | 122 | }); |
| 123 | 123 | |
| 124 | - // Vue.prototype.$Loading = LoadingBar; | |
| 124 | + Vue.prototype.$Loading = LoadingBar; | |
| 125 | 125 | // Vue.prototype.$Message = Message; |
| 126 | 126 | // Vue.prototype.$Modal = Modal; |
| 127 | 127 | // Vue.prototype.$Notice = Notice; | ... | ... |