Logo.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <div class="logo">
  3. <router-link :to="{name:'Console'}">
  4. <LogoSvg alt="logo" />
  5. <h1 v-if="showTitle">{{ this.titles }}</h1>
  6. </router-link>
  7. </div>
  8. </template>
  9. <script>
  10. import LogoSvg from '@/assets/logo.svg?inline'
  11. import { mixin, mixinDevice } from '@/utils/mixin'
  12. export default {
  13. name: 'Logo',
  14. components: {
  15. LogoSvg
  16. },
  17. mixins: [mixin, mixinDevice],
  18. data () {
  19. return {
  20. titles: ''
  21. }
  22. },
  23. props: {
  24. title: {
  25. type: String,
  26. default: 'Guns快速开发平台',
  27. required: false
  28. },
  29. showTitle: {
  30. type: Boolean,
  31. default: true,
  32. required: false
  33. }
  34. },
  35. created () {
  36. if (this.layoutMode === 'topmenu') {
  37. if (this.title.length > 8) {
  38. this.titles = this.title.substring(0, 7) + '...'
  39. } else {
  40. this.titles = this.title
  41. }
  42. } else {
  43. if (this.title.length > 10) {
  44. this.titles = this.title.substring(0, 9) + '...'
  45. } else {
  46. this.titles = this.title
  47. }
  48. }
  49. }
  50. }
  51. </script>