<template>
  <form>
    <div
      class="modal-card"
      style="width: 1000px"
    >
      <header class="modal-card-head">
        <p class="modal-card-title">
          글쓰기
        </p>
      </header>
      <section class="modal-card-body">
        <b-field
          label="제목"
          expanded
        >
          <b-input
            v-if="writeMode == 'insert'"
            v-model="this.modal.title"
          />
          <b-input
            v-else
            v-model="this.modal.title"
            disabled
          />
        </b-field>
        <b-field grouped>
          <b-field
            label="작성자"
            expanded
          >
            <b-input
              v-if="writeMode == 'insert'"
              v-model="this.modal.createUser"
            />
            <b-input
              v-else
              v-model="this.modal.createUser"
              disabled
            />
          </b-field>

          <b-field
            v-if="writeMode != 'insert'"
            label="작성시간"
            expanded
          >
            <b-input
              v-model="this.modal.createTime"
              disabled
            />
          </b-field>
        </b-field>
        <b-field
          label="내용"
          expanded
        >
          <b-input
            v-if="writeMode == 'insert'"
            v-model="this.modal.contents"
            type="textarea"
            rows="17"
          />
          <b-input
            v-else
            v-model="this.modal.contents"
            disabled
            type="textarea"
            rows="17"
          />
        </b-field>
      </section>
      <footer class="modal-card-foot">
        <p class="modal-card-title" />
        <b-button
          icon="magnify"
          class="button"
          type="button"
          @click="$parent.close()"
        >
          <span>닫기</span>
        </b-button>
      </footer>
    </div>
  </form>
</template>

<script>
export default {
  props: {
    modal: {
      type: Object,
    },
    serviceName: String,
    boardName: String,
    writeMode: String,
  },
  mounted() {
    this.init();
  },
  methods: {
    init() {
      // console.log(this);
      if (this.bind == null) {
        // console.log('바인드된 값이 없습니다');
      } else {
        // console.log(this.bind);
      }
    },
  },
};
</script>
