Page 457 - MDP2022-3
P. 457
</div>
</div>
</template>
<script>
export default {
data() { //변수생성
return {
requestBody: this.$route.query,
idx: this.$route.query.idx,
title: '',
author: '',
contents: '',
created_at: ''
}
},
mounted() {
this.fnGetView()
},
methods: {
fnGetView() {
if (this.idx !== undefined) {
this.$axios.get(this.$serverUrl + '/board/' + this.idx, {
params: this.requestBody
}).then((res) => {
this.title = res.data.title
this.author = res.data.author
this.contents = res.data.contents
this.created_at = res.data.created_at
}).catch((err) => {
console.log(err)
})
}
},
fnList() {
delete this.requestBody.idx
this.$router.push({
path: './list',
query: this.requestBody
})
},
fnView(idx) {
this.requestBody.idx = idx
this.$router.push({
path: './detail',
query: this.requestBody