<template>
  <ui-editor-head class="header">
    <div class="main">
      <span class="title">{{ sysTitle }}</span>
    </div>

    <div class="control">
      <template v-if="isEdit">
        <ui-button width="105px" @click="leave">退出</ui-button>
        <ui-button 
          width="105px" 
          type="primary" 
          class="save" 
          v-if="isOld"
          @click="save"
        >
          保存
        </ui-button>
      </template>
    </div>
  </ui-editor-head>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import { isEdit, title, isOld, leave, save } from '@/store'

const props = defineProps<{ title?: string }>()
const sysTitle = computed(() => props.title || title.value)
</script>

<style lang="sass" scoped>
@import './style.scss'
</style>
