Home.vue 1.28 KB
<template>
  <v-sheet>
    <!-- autocomplete에 저장된 tag 넣어서(동영상 업로드 할 때마다 tag가 저장됨) 자동완성 되게끔.-->
    <v-text-field
      class="mx-10 mt-4 mb-5"
      prepend-inner-icon="mdi-shape"
      v-model="search"
      label="Tag"
      placeholder="Search Tag"
      type="text"
    >
    </v-text-field>
    <!-- 동영상 리스트 -->
    <v-layout justify-center>
      <v-row class="mx-5">
        <v-flex
          xs12
          sm6
          v-for="(post, index) in postList"
          :key="index"
          class="mx-0"
        >
          <v-card class="mx-2 my-1">
            <div>{{ post.title }}1</div>
          </v-card>
        </v-flex>
      </v-row>
    </v-layout>
  </v-sheet>
</template>
<script>
// @ is an alias to /src
export default {
  name: "Home",
  components: {},
  data() {
    return {
      postList: [],
      search: "",
      params: {
        tag: ["", ""],
        skip: 0
      }
    };
  },
  mounted() {
    this.getPost();
  },
  methods: {
    getPost() {
      this.$axios
        .get("/home/list", { params: this.params })
        .then(r => {
          this.postList = r.data.d;
          console.log(this.postList);
        })
        .catch(e => {
          console.log(e);
        });
    }
  }
};
</script>