index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <div class="app-container">
  3. <el-card class="box-card">
  4. <div slot="header">
  5. <a class="link-type link-title" target="_blank" href="https://panjiachen.github.io/vue-element-admin-site/guide/advanced/theme.html">
  6. {{ $t('theme.documentation') }}
  7. </a>
  8. </div>
  9. <div class="box-item">
  10. <span class="field-label">{{ $t('theme.change') }} : </span>
  11. <el-switch v-model="theme" />
  12. <aside style="margin-top:15px;">{{ $t('theme.tips') }}</aside>
  13. </div>
  14. </el-card>
  15. <div class="block">
  16. <el-button type="primary">
  17. Primary
  18. </el-button>
  19. <el-button type="success">
  20. Success
  21. </el-button>
  22. <el-button type="info">
  23. Info
  24. </el-button>
  25. <el-button type="warning">
  26. Warning
  27. </el-button>
  28. <el-button type="danger">
  29. Danger
  30. </el-button>
  31. </div>
  32. <div class="block">
  33. <el-button type="primary" icon="el-icon-edit" />
  34. <el-button type="primary" icon="el-icon-share" />
  35. <el-button type="primary" icon="el-icon-delete" />
  36. <el-button type="primary" icon="el-icon-search">
  37. Search
  38. </el-button>
  39. <el-button type="primary">
  40. Upload
  41. <i class="el-icon-upload el-icon-right" />
  42. </el-button>
  43. </div>
  44. <div class="block">
  45. <el-tag v-for="tag in tags" :key="tag.type" :type="tag.type" class="tag-item">
  46. {{ tag.name }}
  47. </el-tag>
  48. </div>
  49. <div class="block">
  50. <el-radio-group v-model="radio">
  51. <el-radio :label="3">
  52. Option A
  53. </el-radio>
  54. <el-radio :label="6">
  55. Option B
  56. </el-radio>
  57. <el-radio :label="9">
  58. Option C
  59. </el-radio>
  60. </el-radio-group>
  61. </div>
  62. <div class="block">
  63. <el-slider v-model="slideValue" />
  64. </div>
  65. </div>
  66. </template>
  67. <script>
  68. import { toggleClass } from '@/utils'
  69. import '@/assets/custom-theme/index.css' // the theme changed version element-ui css
  70. export default {
  71. name: 'Theme',
  72. data() {
  73. return {
  74. theme: false,
  75. tags: [
  76. { name: 'Tag One', type: '' },
  77. { name: 'Tag Two', type: 'info' },
  78. { name: 'Tag Three', type: 'success' },
  79. { name: 'Tag Four', type: 'warning' },
  80. { name: 'Tag Five', type: 'danger' }
  81. ],
  82. slideValue: 50,
  83. radio: 3
  84. }
  85. },
  86. watch: {
  87. theme() {
  88. toggleClass(document.body, 'custom-theme')
  89. }
  90. }
  91. }
  92. </script>
  93. <style scoped>
  94. .field-label{
  95. vertical-align: middle;
  96. }
  97. .box-card {
  98. width: 400px;
  99. max-width: 100%;
  100. margin: 20px auto;
  101. }
  102. .block {
  103. padding: 30px 24px;
  104. }
  105. .tag-item {
  106. margin-right: 15px;
  107. }
  108. </style>