DEV-HJ 2022. 11. 7. 20:42
반응형
<template>
    <div>
      <input type="text" v-model="subject" />
      <textarea name="" id="" cols="100" rows="10" v-model="contents"></textarea>
      
      <button type="button" @click="noticeInsert">INSERT</button>
    </div>  
</template>

<script>
const commonPath = 'api/common/';

export default {
  data() {
    return {
      subject: '',
      contents: '',
      regUser: '',
      updUser: '',
    };
  },

  mounted() {},

  methods: {
      noticeInsert() {
          if (!this.subject) {
            this.$openAalert({ message: '제목을 입력하세요' });
          } else if (!this.contents) {
            this.$openAalert({ message: '내용을 입력하세요' });
          } else {
            this.$axios
              .post(commonPath + 'insert-notice', {
                subject: this.subject,
                contents: this.subject,
                regUser: this.regUser,
                updUser: this.updUser,
              })
              .then(res => {
                console.log(res);
              })
              .cathc(error => {
                console.log(error);
              });
          }
        },
   
  },
};
</script>

<style lang="scss" scoped></style>
반응형