2sjdeveloper / vue-project

0 stars 0 forks source link

24-02-06-tue. 뷰+노드 #4

Open 2sjdeveloper opened 8 months ago

2sjdeveloper commented 8 months ago

1교시

2sjdeveloper commented 8 months ago

2교시

image image image image

User 아아 이게 userListView.vue 파일이야

<!-- (24-02-05-mon) -->
<!-- UserListView.vue -->

<template>
  <div class="container">
    <h1>전체 회원 조회</h1>
    <table class="table">
      <thead>
        <tr>
          <th>No.</th>
          <th>ID</th>
          <th>이름</th>
          <th>성별</th>
          <th>가입날짜</th>          
        </tr>
        <tr>
          <td>{{ getUserLi.user_no }}</td>
          <td>user_id</td>
          <td>user_name</td>
          <td>user_gender</td>
          <td>join_data</td>
        </tr>
      </thead>
      <tbody>
      </tbody>
    </table>
  </div>
</template>
<script>
import axios from 'axios';

export default {
  data() {
    return {
      userList: [],
    };
  },
  created() {
    this.getUserList(); //비동기작업
  },
  methods: {
    async getUserList() {
      // 반드시 순서대로 진행해줘야 함.
      //동기작업 : async, await 를 붙여줘야 함.
      let result = await axios.get("/api/users").catch((err) => console.log(err));
      let list = result.data;
      this.userList = list;
    },
  },
};
</script>

image image

2sjdeveloper commented 8 months ago

image

2sjdeveloper commented 8 months ago

3교시

image

2sjdeveloper commented 8 months ago

5교시

개념 모델 디렉티브는 HTML 요소에 Vue 데이터를 연결하는 Vue의 디렉티브 중 하나입니다. 주로 ,