Bläddra i källkod

【更新】系统名称长度超出后自动省略后面部分

俞宝山 4 år sedan
förälder
incheckning
73ac72ba47
1 ändrade filer med 23 tillägg och 1 borttagningar
  1. 23 1
      _web/src/components/tools/Logo.vue

+ 23 - 1
_web/src/components/tools/Logo.vue

@ -2,19 +2,26 @@
  <div class="logo">
    <router-link :to="{name:'Console'}">
      <LogoSvg alt="logo" />
      <h1 v-if="showTitle">{{ title }}</h1>
      <h1 v-if="showTitle">{{ this.titles }}</h1>
    </router-link>
  </div>
</template>
<script>
import LogoSvg from '@/assets/logo.svg?inline'
import { mixin, mixinDevice } from '@/utils/mixin'
export default {
  name: 'Logo',
  components: {
    LogoSvg
  },
  mixins: [mixin, mixinDevice],
  data () {
    return {
      titles: ''
    }
  },
  props: {
    title: {
      type: String,
@ -26,6 +33,21 @@ export default {
      default: true,
      required: false
    }
  },
  created () {
    if (this.layoutMode === 'topmenu') {
      if (this.title.length > 8) {
        this.titles = this.title.substring(0, 7) + '...'
      } else {
        this.titles = this.title
      }
    } else {
      if (this.title.length > 10) {
        this.titles = this.title.substring(0, 9) + '...'
      } else {
        this.titles = this.title
      }
    }
  }
}
</script>