loading.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <div>
  3. <nut-demoheader
  4. :name="$route.name"
  5. ></nut-demoheader>
  6. <a class="button button-primary" href="javascript:;" @click="showLoading1">自定义ICON</a>
  7. <a class="button button-primary" href="javascript:;" @click="showLoading2">禁止点击关闭,4秒后自动关闭</a>
  8. <a class="button button-primary" href="javascript:;" @click="showLoading3">全屏+自定义文字及颜色</a>
  9. <a class="button button-primary" href="javascript:;" @click="showLoading4">渐隐渐现</a>
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. data(){
  15. return{
  16. loading1:null,
  17. loading2:null,
  18. loading3:null,
  19. loading4:null,
  20. }
  21. },
  22. mounted(){
  23. this.loading1 = this.$loading();
  24. this.loading2 = this.$loading({
  25. maxDuring:4000,
  26. text:'加载中...',
  27. userClose:false
  28. });
  29. this.loading3 = this.$loading({
  30. mini:false,
  31. text:'LOADING',
  32. textColor:'rgba(255,255,255,.7)'
  33. });
  34. this.loading4 = this.$loading({
  35. fade:true
  36. });
  37. },
  38. methods:{
  39. showLoading1(){
  40. this.loading1.show();
  41. },
  42. showLoading2(){
  43. this.loading2.show();
  44. },
  45. showLoading3(){
  46. this.loading3.show();
  47. },
  48. showLoading4(){
  49. this.loading4.show();
  50. },
  51. }
  52. }
  53. </script>
  54. <style>
  55. </style>