/example/App.vue

https://github.com/biigpongsatorn/vue-element-loading · Vue · 183 lines · 179 code · 3 blank · 1 comment · 0 complexity · dd7b99a2f6b7f91825ce8bed40391dda MD5 · raw file

  1. <template>
  2. <div>
  3. <div id="app">
  4. <VueElementLoading
  5. :spinner="spinnerKind"
  6. :size="spinnerSize"
  7. :duration="spinnerDuration"
  8. :color="spinnerColor"
  9. :active="fullscreenGreenBg"
  10. :text="text"
  11. :textStyle="textStyles[spinnerTextStyle] || {}"
  12. backgroundColor="rgba(66, 185, 131, .9)"
  13. is-full-screen
  14. />
  15. <VueElementLoading
  16. :spinner="spinnerKind"
  17. :size="spinnerSize"
  18. :duration="spinnerDuration"
  19. :color="spinnerColor"
  20. :active="fullscreen"
  21. :text="text"
  22. :textStyle="textStyles[spinnerTextStyle] || {}"
  23. is-full-screen
  24. />
  25. <VueElementLoading
  26. :spinner="spinnerKind"
  27. :size="spinnerSize"
  28. :duration="spinnerDuration"
  29. :color="spinnerColor"
  30. :active="show && !fullscreen && !fullscreenGreenBg"
  31. :text="text"
  32. :textStyle="textStyles[spinnerTextStyle] || {}"
  33. />
  34. <VueElementLoading :active="pikachu">
  35. <img
  36. src="https://i.pinimg.com/originals/9f/b1/25/9fb125f1fedc8cc62ab5b20699ebd87d.gif"
  37. width="55px"
  38. height="55px"
  39. >
  40. </VueElementLoading>
  41. <span>
  42. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce id fermentum quam. Proin sagittis,
  43. nibh id hendrerit imperdiet, elit sapien laoreet elit
  44. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce id fermentum quam. Proin sagittis,
  45. nibh id hendrerit imperdiet, elit sapien laoreet elit
  46. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce id fermentum quam. Proin sagittis,
  47. nibh id hendrerit imperdiet, elit sapien laoreet elit
  48. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce id fermentum quam. Proin sagittis,
  49. nibh id hendrerit imperdiet, elit sapien laoreet elit
  50. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce id fermentum quam. Proin sagittis,
  51. nibh id hendrerit imperdiet, elit sapien laoreet elit
  52. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce id fermentum quam. Proin sagittis,
  53. nibh id hendrerit imperdiet, elit sapien laoreet elit
  54. </span>
  55. </div>
  56. <div class="f-left-w-100pct">
  57. <br>
  58. <div>
  59. <select v-model="spinnerKind">
  60. <option value="bar-fade-scale">bar-fade-scale</option>
  61. <option value="bar-fade">bar-fade</option>
  62. <option value="line-down">line-down</option>
  63. <option value="line-scale">line-scale</option>
  64. <option value="line-wave">line-wave</option>
  65. <option value="ring">ring</option>
  66. <option value="spinner">spinner</option>
  67. <option value="mini-spinner">mini-spinner</option>
  68. </select>
  69. <select v-model="spinnerColor">
  70. <option value="#f00">Red</option>
  71. <option value="#0f0">Green</option>
  72. <option value="#FF6700">Default Color</option>
  73. <option value="#00f">Blue</option>
  74. </select>
  75. <select v-model="spinnerSize">
  76. <option value="32">32px</option>
  77. <option value="64">64px</option>
  78. <option value="128">128px</option>
  79. <option value="256">256px</option>
  80. </select>
  81. <select v-model="spinnerDuration">
  82. <option value="0.1">Very Fast</option>
  83. <option value="0.3">Fast</option>
  84. <option value="0.6">Default Speed</option>
  85. <option value="1.2">Slow</option>
  86. <option value="2.4">Very Slow</option>
  87. </select>
  88. <select v-model="spinnerTextStyle">
  89. <option value="none">No Text Style</option>
  90. <option value="bold">Bold Text</option>
  91. <option value="bigNeonGreen">Big Neon Green</option>
  92. </select>
  93. </div>
  94. <input
  95. v-model="text"
  96. class="btn-toggle"
  97. type="text"
  98. placeholder="Custom text..."
  99. />
  100. </div>
  101. <div class="f-left-w-100pct">
  102. <div class="btn-toggle">
  103. <button @click="toggleInsideComponentLoader">Toggle (Inside Container)</button>
  104. </div>
  105. <div class="btn-toggle">
  106. <button @click="togglePikachuLoader">Toggle (Pikachu)</button>
  107. </div>
  108. <div class="btn-toggle">
  109. <button @click="activateFullScreen()">Full Screen</button>
  110. </div>
  111. <div class="btn-toggle">
  112. <button @click="activateFullScreenGreenBg()">Full Screen (Green background color)</button>
  113. </div>
  114. </div>
  115. </div>
  116. </template>
  117. <script>
  118. // import VueElementLoading from '../src'
  119. import VueElementLoading from '../lib/vue-element-loading.min.js'
  120. export default {
  121. name: 'app',
  122. data () {
  123. return {
  124. textStyles: {
  125. none: {},
  126. bold: {'font-weight':'bold'},
  127. bigNeonGreen : { 'font-size':'300%', color:'#0F0', 'text-shadow':'0 0 1em #0F0' }
  128. },
  129. text: '',
  130. show: true,
  131. fullscreen: false,
  132. fullscreenGreenBg: false,
  133. pikachu: false,
  134. spinnerKind: 'bar-fade-scale',
  135. spinnerColor: '#FF6700',
  136. spinnerSize: '32',
  137. spinnerDuration: '0.6',
  138. spinnerTextStyle: 'none'
  139. }
  140. },
  141. created () {
  142. setTimeout(() => { this.show = false }, 2000)
  143. },
  144. methods: {
  145. toggleInsideComponentLoader () {
  146. this.show = !this.show;
  147. this.pikachu = false;
  148. },
  149. togglePikachuLoader () {
  150. this.pikachu = !this.pikachu;
  151. this.show = false;
  152. },
  153. activateFullScreen () {
  154. this.fullscreen = true
  155. setTimeout(() => { this.fullscreen = false }, 2000)
  156. },
  157. activateFullScreenGreenBg () {
  158. this.fullscreenGreenBg = true
  159. setTimeout(() => { this.fullscreenGreenBg = false }, 2000)
  160. }
  161. },
  162. components: { VueElementLoading }
  163. }
  164. </script>
  165. <style scoped>
  166. #app {
  167. float: left;
  168. width: 500px;
  169. height: 500px;
  170. border: 1px solid #ccc;
  171. }
  172. .btn-toggle {
  173. float: left;
  174. margin: 20px;
  175. }
  176. .f-left-w-100pct {
  177. float: left;
  178. width: 100%;
  179. }
  180. </style>