logo.vue.bak 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <div class="logo">
  3. <router-link to="/">
  4. <span class="h1">{{ shortName }}</span>
  5. </router-link>
  6. <el-tooltip effect="dark" :content="switchTip" placement="bottom" v-if="!collapse">
  7. <el-switch :value="navMode" active-color="#ff1b14" active-value="nested" inactive-value="lite" @change="switchMode"> </el-switch>
  8. </el-tooltip>
  9. </div>
  10. </template>
  11. <script>
  12. import { createNamespacedHelpers } from 'vuex';
  13. const { mapState } = createNamespacedHelpers('naf/menu');
  14. export default {
  15. props: {
  16. shortName: String,
  17. width: {
  18. type: String,
  19. default: '256px',
  20. },
  21. navMode: String,
  22. },
  23. methods: {
  24. switchMode(payload) {
  25. this.$emit('switch-mode', payload);
  26. },
  27. },
  28. computed: {
  29. ...mapState(['collapse']),
  30. switchTip() {
  31. return this.navMode == 'nested' ? '切换到简单导航模式' : '切换到经典导航模式';
  32. },
  33. },
  34. };
  35. </script>
  36. <style lang="less" scoped>
  37. .logo {
  38. display: table;
  39. margin-left: 5%;
  40. padding: 0 16px;
  41. overflow: hidden;
  42. width: 18%;
  43. height: 100%;
  44. .h1 {
  45. color: #000;
  46. font-size: 1.5em;
  47. width: 70%;
  48. float: left;
  49. display: block;
  50. line-height: 7rem;
  51. }
  52. .el-switch {
  53. margin-top: 2.8rem;
  54. display: table-cell;
  55. width: 10%;
  56. float: right;
  57. margin-right: 0.5rem;
  58. }
  59. }
  60. </style>