<template>
  <Modal class="mch-create-modal" v-model="dlgShow" :mask-closable="false" title="项目名称" width="300">
    <Input v-model="projectName" @keydown.enter="ok" placeholder="输入项目名称" />
    <template #footer>
      <div class="footer">
        <Button type="text" @click="cancel">取消</Button>
        <Button type="primary" @click="ok">确定</Button>
      </div>
    </template>
  </Modal>
</template>

<script>
export default {
  methods: {
    show(options) {
      this.options = options
      this.projectName = this.options.name || '新建项目'
      this.dlgShow = true
    },
    ok() {
      this.$emit('on-ok', this.projectName)
    },
    cancel() {
      this.$emit('on-cancel')
      this.dlgShow = false
    }
  },
  data() {
    return {
      dlgShow: false,
      projectName: ''
    }
  }
}
</script>