logo.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <div class="logo" :style="{width: width}">
  3. <router-link to="/">
  4. <img src="@/assets/logo1.svg" alt="logo" style="height:32px;width:32px;" />
  5. </router-link>
  6. <h1>{{shortName}}</h1>
  7. <el-tooltip effect="dark" :content="switchTip" placement="bottom">
  8. <el-switch :value="navMode" active-color="#13ce66"
  9. active-value="nested" inactive-value="lite" @change="switchMode">
  10. </el-switch>
  11. </el-tooltip>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. props: {
  17. shortName: String,
  18. width: {
  19. type: String,
  20. default: '256px',
  21. },
  22. navMode: String,
  23. },
  24. methods: {
  25. switchMode(payload) {
  26. this.$emit('switch-mode', payload);
  27. },
  28. },
  29. computed: {
  30. switchTip() {
  31. return this.navMode == 'nested' ? '切换到简单导航模式' : '切换到经典导航模式';
  32. },
  33. },
  34. };
  35. </script>
  36. <style lang="less" scoped>
  37. .logo {
  38. display: table;
  39. border-right: solid 1px #e6e6e6;
  40. padding: 0 16px;
  41. overflow: hidden;
  42. img,
  43. h1 {
  44. vertical-align: middle;
  45. }
  46. h1 {
  47. display: inline-block;
  48. margin: 0 0 0 12px;
  49. }
  50. .el-switch {
  51. vertical-align: middle;
  52. text-align: right;
  53. display: table-cell;
  54. }
  55. }
  56. </style>