resource.vue 3.9 KB

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