download.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <div class="action-area">
  3. <div class="action-area-main">
  4. <div class="action-button">
  5. <el-button type="warning" @click.stop="onReset">{{getActionDisplayName("reset-theme")}}</el-button>
  6. </div>
  7. <div class="action-button">
  8. <el-button
  9. type="primary"
  10. :loading=downloading
  11. style="background: #66b1ff;border-color: #66b1ff"
  12. @click.stop="onDownload">
  13. {{getActionDisplayName("download-theme")}}
  14. </el-button>
  15. </div>
  16. </div>
  17. </div>
  18. </template>
  19. <style>
  20. .action-area {
  21. width: 24%;
  22. max-width: 400px;
  23. position: fixed;
  24. right: 0;
  25. bottom: 0;
  26. padding-right: 1%;
  27. }
  28. @media (min-width: 1600px) {
  29. .action-area {
  30. padding-right: calc((100% - 1600px) / 2);
  31. }
  32. }
  33. .action-area-main {
  34. opacity: .95;
  35. background: #F5F7FA;
  36. height: 70px;
  37. bottom: 0;
  38. width: 97%;
  39. box-sizing: border-box;
  40. margin: 0 .5% 0 5%;
  41. }
  42. .action-button {
  43. width: 50%;
  44. text-align: center;
  45. display: inline-block;
  46. padding-top: 15px;
  47. }
  48. </style>
  49. <script>
  50. import { getActionDisplayName } from './utils/utils.js';
  51. export default {
  52. data() {
  53. return {
  54. downloading: false
  55. };
  56. },
  57. methods: {
  58. onReset() {
  59. this.$parent.onReset();
  60. },
  61. getActionDisplayName(key) {
  62. return getActionDisplayName(key);
  63. },
  64. onDownload() {
  65. this.downloading = true;
  66. this.$parent.onDownload()
  67. .then()
  68. .catch((err) => {
  69. this.$parent.onError(err);
  70. })
  71. .then(() => {
  72. this.downloading = false;
  73. });
  74. ga('send', 'event', 'ThemeConfigurator', 'Download');
  75. }
  76. }
  77. };
  78. </script>