|
| 1 | +<template> |
| 2 | + <div id="app"> |
| 3 | + <div class="container"> |
| 4 | + <h1>Vue Count Up</h1> |
| 5 | + <h3>simple example</h3> |
| 6 | + <code> |
| 7 | + <vue-count-up :end-val="123456" /> |
| 8 | + </code> |
| 9 | + <br> |
| 10 | + <div> |
| 11 | + <vue-count-up :end-val="123456" class="my-vue-count-up" /> |
| 12 | + </div> |
| 13 | + <br> |
| 14 | + <h3>delay example</h3> |
| 15 | + <div> |
| 16 | + <code> |
| 17 | + <vue-count-up :end-val="654321" :delay="1500" /> |
| 18 | + </code> |
| 19 | + </div> |
| 20 | + <br> |
| 21 | + <div> |
| 22 | + <vue-count-up :end-val="654321" :delay="1500" class="my-vue-count-up" /> |
| 23 | + </div> |
| 24 | + <br> |
| 25 | + <h3>custom example</h3> |
| 26 | + <code> |
| 27 | + <vue-count-up :start-val="0" :end-val="123456" :autoplay="false" /> |
| 28 | + </code> |
| 29 | + <br> |
| 30 | + <div> |
| 31 | + <vue-count-up ref="example" :start-val="startVal" :end-val="endVal" :autoplay="autoplay" class="my-vue-count-up" /> |
| 32 | + </div> |
| 33 | + <br> |
| 34 | + <div> |
| 35 | + <label class="label" for="startValInput">startVal: <input type="number" v-model.number='startVal' name='startValInput' /></label> |
| 36 | + <label class="label" for="endValInput">endVal: <input type="number" v-model.number='endVal' name='endVaInput' /></label> |
| 37 | + </div> |
| 38 | + <br> |
| 39 | + <div> |
| 40 | + <div class="example-btn" @click='startClick'>start</div> |
| 41 | + <div class="example-btn" @click='pauseResumeClick'>pause/resume</div> |
| 42 | + <div class="example-btn" @click='randomEndValClick'>random end val</div> |
| 43 | + </div> |
| 44 | + </div> |
| 45 | + </div> |
| 46 | +</template> |
| 47 | + |
| 48 | +<script> |
| 49 | +import VueCountUp from '../packages' |
| 50 | +
|
| 51 | +export default { |
| 52 | + name: 'App', |
| 53 | + components: { |
| 54 | + VueCountUp |
| 55 | + }, |
| 56 | + data () { |
| 57 | + return { |
| 58 | + startVal: 0, |
| 59 | + endVal: 123789, |
| 60 | + autoplay: false |
| 61 | + } |
| 62 | + }, |
| 63 | + methods: { |
| 64 | + startClick () { |
| 65 | + this.$refs.example.reset() |
| 66 | + this.$refs.example.start() |
| 67 | + }, |
| 68 | + pauseResumeClick () { |
| 69 | + this.$refs.example.pauseResume() |
| 70 | + }, |
| 71 | + randomEndValClick () { |
| 72 | + this.endVal = Math.floor(Math.random() * 100000) |
| 73 | + } |
| 74 | + } |
| 75 | +} |
| 76 | +</script> |
| 77 | + |
| 78 | +<style lang="scss"> |
| 79 | +body { |
| 80 | + margin: 0; |
| 81 | + padding: 0; |
| 82 | +} |
| 83 | +
|
| 84 | +code { |
| 85 | + display: block; |
| 86 | + padding: 8px 15px; |
| 87 | + background-color: #f6f8fa; |
| 88 | + border-radius: 5px; |
| 89 | + border: 1px solid #e5e5e5; |
| 90 | + overflow-x: auto; |
| 91 | + font-family: Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal; |
| 92 | + color: #333; |
| 93 | + font-size: 12px; |
| 94 | +} |
| 95 | +
|
| 96 | +#app { |
| 97 | + font-family: Avenir, Helvetica, Arial, sans-serif; |
| 98 | + -webkit-font-smoothing: antialiased; |
| 99 | + -moz-osx-font-smoothing: grayscale; |
| 100 | + color: #2c3e50; |
| 101 | +} |
| 102 | +
|
| 103 | +.container { |
| 104 | + width: 960px; |
| 105 | + margin: 0 auto; |
| 106 | +} |
| 107 | +
|
| 108 | +h1 { |
| 109 | + font-size: 60px; |
| 110 | + margin: 30px 0; |
| 111 | + color: #70b7fd; |
| 112 | +} |
| 113 | +
|
| 114 | +.my-vue-count-up { |
| 115 | + font-size: 40px; |
| 116 | + color: #70b7fd; |
| 117 | +} |
| 118 | +
|
| 119 | +.label { |
| 120 | + color: #2f4f4f; |
| 121 | + font-size: 16px; |
| 122 | + display: inline-block; |
| 123 | + margin: 15px 30px 15px 0; |
| 124 | +} |
| 125 | +
|
| 126 | +input { |
| 127 | + position: relative; |
| 128 | + display: inline-block; |
| 129 | + padding: 4px 7px; |
| 130 | + width: 100px; |
| 131 | + height: 28px; |
| 132 | + cursor: text; |
| 133 | + font-size: 12px; |
| 134 | + line-height: 1.5; |
| 135 | + color: rgba(0, 0, 0, .65); |
| 136 | + background-color: #fff; |
| 137 | + background-image: none; |
| 138 | + border: 1px solid #d9d9d9; |
| 139 | + border-radius: 4px; |
| 140 | + -webkit-transition: all .3s; |
| 141 | + transition: all .3s; |
| 142 | +} |
| 143 | +
|
| 144 | +.example-btn { |
| 145 | + display: inline-block; |
| 146 | + margin-bottom: 0; |
| 147 | + font-weight: 500; |
| 148 | + text-align: center; |
| 149 | + -ms-touch-action: manipulation; |
| 150 | + touch-action: manipulation; |
| 151 | + cursor: pointer; |
| 152 | + background-image: none; |
| 153 | + white-space: nowrap; |
| 154 | + line-height: 1.5; |
| 155 | + padding: 10px 20px; |
| 156 | + font-size: 14px; |
| 157 | + border-radius: 4px; |
| 158 | + -webkit-user-select: none; |
| 159 | + -moz-user-select: none; |
| 160 | + -ms-user-select: none; |
| 161 | + user-select: none; |
| 162 | + -webkit-transition: all .3s cubic-bezier(.645, .045, .355, 1); |
| 163 | + transition: all .3s cubic-bezier(.645, .045, .355, 1); |
| 164 | + position: relative; |
| 165 | + color: rgba(0, 0, 0, .65); |
| 166 | + background-color: #fff; |
| 167 | + border: 1px solid #d9d9d9; |
| 168 | + margin-right: 10px; |
| 169 | +
|
| 170 | + &:hover { |
| 171 | + background-color: #f0f0f0; |
| 172 | + } |
| 173 | +} |
| 174 | +</style> |
0 commit comments