seller/Menu1Detail.vue

gegus1220·2022년 2월 14일
0

3rd_20220124

목록 보기
19/29
<template>
  <div>
        <h3>Menu1Detail.vue</h3>
        <el-card class="fade-in-left">

        <div v-if="state.items">

            <img :src="state.items.imageUrl" style="width:300px;"> <br />
            <div v-for="tmp in state.items.subImage" :key="tmp"
                style="display:inline-block">
                <img :src="tmp.imageUrl" style="width:200px;height:200px;" >
            </div>

            코드: {{state.items._id}}<br />
            물품명: {{state.items.name}}<br />
            가격: {{state.items.price}}<br />
            수량: {{state.items.quantity}}<br />
            내용: {{state.items.content}}<br />
            등록일자: {{state.items.regdate}}<br />



        </div>
        </el-card>

  </div>
</template>

<script>
import { reactive, onMounted } from 'vue';
import axios from 'axios';
import { useRoute } from 'vue-router';

export default {
    setup () {
        const route = useRoute();
        const state = reactive({
            code: route.query.code,
            token: sessionStorage.getItem("TOKEN")

        });

        const handleLoadData = async() => {
            const url = `/seller/selectone?code=${state.code}`;
            const headers  = { 
                "Content-Type": "multipart/form-data",
                "token": state.token 
            };

            const response = await axios.get(url, { headers });
            console.log(response.data);

            if(response.data.status === 200) {
                state.items = response.data.result;
            }       
        }

        onMounted( async() => {
            await handleLoadData();
        });

        return { state, handleLoadData }
    }
}
</script>

<style lang="scss" scoped>
    @import url(../../assets/mystyle.css);
</style>

0개의 댓글