download.vue 1.5 KB

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