resource.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <script lang="ts" setup>
  2. import { computed } from 'vue'
  3. import { isClient } from '@vueuse/core'
  4. import { useLang } from '../../composables/lang'
  5. import resourceLocale from '../../../i18n/pages/resource.json'
  6. import { sendEvent } from '../../../config/analytics'
  7. const mirrorUrl = 'element-plus.gitee.io'
  8. const isMirrorUrl = () => {
  9. if (!isClient) return
  10. return window.location.hostname === mirrorUrl
  11. }
  12. const resourceUrl = {
  13. github: {
  14. sketch:
  15. 'https://github.com/ElementUI/Resources/raw/master/Element_Plus_Design_System_2022_1.0_Beta.zip',
  16. axure:
  17. 'https://github.com/ElementUI/Resources/raw/master/Element_Components_v2.1.0.rplib',
  18. },
  19. gitee: {
  20. sketch:
  21. 'https://gitee.com/element-plus/resources/raw/master/Element_Plus_Design_System_2022_1.0_Beta.zip',
  22. axure:
  23. 'https://gitee.com/element-plus/resources/raw/master/Element_Components_v2.1.0.rplib',
  24. },
  25. }[isMirrorUrl() ? 'gitee' : 'github']
  26. const lang = useLang()
  27. const resourceLang = computed(() => resourceLocale[lang.value])
  28. const onClick = (item: string) => {
  29. sendEvent('resource_download', item)
  30. }
  31. </script>
  32. <template>
  33. <div class="page-resource">
  34. <h1>{{ resourceLang.title }}</h1>
  35. <p>{{ resourceLang.lineOne }}</p>
  36. <p v-html="resourceLang.lineTwo" />
  37. <div class="flex flex-wrap justify-center mt-32px">
  38. <div class="inline-flex w-full md:w-1/3" p="2" pl-0>
  39. <el-card class="card" shadow="hover">
  40. <axure-components-svg w="30" alt="axure" />
  41. <h3>{{ resourceLang.axure }}</h3>
  42. <p>
  43. {{ resourceLang.axureIntro }}
  44. </p>
  45. <a
  46. target="_blank"
  47. :href="resourceUrl.axure"
  48. @click="onClick('axure')"
  49. >
  50. <el-button type="primary">{{ resourceLang.download }}</el-button>
  51. </a>
  52. </el-card>
  53. </div>
  54. <div class="inline-flex w-full md:w-1/3" p="2">
  55. <el-card class="card" shadow="hover">
  56. <sketch-template-svg w="30" alt="Sketch" />
  57. <h3>{{ resourceLang.sketch }}</h3>
  58. <p>
  59. {{ resourceLang.sketchIntro }}
  60. </p>
  61. <a
  62. target="_blank"
  63. :href="resourceUrl.sketch"
  64. @click="onClick('sketch')"
  65. >
  66. <el-button type="primary">{{ resourceLang.download }}</el-button>
  67. </a>
  68. </el-card>
  69. </div>
  70. <div class="inline-flex w-full md:w-1/3" p="2">
  71. <el-card class="card" shadow="hover">
  72. <figma-template-svg w="30" alt="Figma" />
  73. <h3>{{ resourceLang.figma }}</h3>
  74. <p>
  75. {{ resourceLang.figmaIntro }}
  76. </p>
  77. <a
  78. href="https://www.figma.com/community/file/1021254029764378306"
  79. target="_blank"
  80. @click="onClick('figma')"
  81. >
  82. <el-button type="primary">{{ resourceLang.download }}</el-button>
  83. </a>
  84. </el-card>
  85. </div>
  86. </div>
  87. </div>
  88. </template>
  89. <style lang="scss" scoped>
  90. .page-resource {
  91. box-sizing: border-box;
  92. padding: 0 40px;
  93. h1 {
  94. color: var(--text-color);
  95. margin-bottom: 24px;
  96. }
  97. p {
  98. color: var(--text-color-light);
  99. line-height: 24px;
  100. margin: 0;
  101. &:last-of-type {
  102. margin-top: 8px;
  103. }
  104. }
  105. }
  106. .card {
  107. text-align: center;
  108. padding: 32px 0;
  109. img {
  110. margin: auto;
  111. margin-bottom: 16px;
  112. height: 87px;
  113. }
  114. h3 {
  115. margin: 10px;
  116. font-size: 18px;
  117. font-weight: normal;
  118. }
  119. p {
  120. font-size: 14px;
  121. color: #99a9bf;
  122. padding: 0 30px;
  123. margin: 0;
  124. word-break: break-word;
  125. line-height: 1.8;
  126. min-height: 75px;
  127. margin-bottom: 16px;
  128. }
  129. }
  130. </style>