반응형
<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>
반응형
'Dev > RestAPI (Java-Spring, vue.js)' 카테고리의 다른 글
5. [Delete] Java-Spring (0) | 2022.11.13 |
---|---|
4. [Update] vue.js (0) | 2022.11.13 |
4. [Update] Java-Spring (0) | 2022.11.13 |
3. [Insert] Java-Spring (0) | 2022.11.07 |
1. 오늘 기준으로 60일치 메뉴별 방문자수 집계 API (0) | 2022.09.05 |