49 lines
1.0 KiB
Vue
49 lines
1.0 KiB
Vue
<template>
|
|
<ul class="cate-list list-unstyled d-flex flex-wrap mb-0">
|
|
<li
|
|
v-for="category in lists"
|
|
:key="category.CMNCODVAL"
|
|
class="mt-2 mx-1"
|
|
>
|
|
<button
|
|
type="button"
|
|
class="btn"
|
|
:class="{
|
|
'btn-outline-primary': category !== selectedCategory,
|
|
'btn-primary': category === selectedCategory
|
|
}"
|
|
@click="selectCategory(category)"
|
|
>{{ category.CMNCODNAM }}</button>
|
|
</li>
|
|
</ul>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { defineProps, ref } from 'vue';
|
|
|
|
// lists prop 정의
|
|
const props = defineProps({
|
|
lists: {
|
|
type: Array,
|
|
required: true,
|
|
},
|
|
});
|
|
|
|
// 카테고리 선택
|
|
const selectedCategory = ref(null);
|
|
|
|
const selectCategory = (category) => {
|
|
selectedCategory.value = category;
|
|
};
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
.cate-list {
|
|
margin-left: -0.25rem;
|
|
}
|
|
|
|
@media screen and (max-width:450px) {
|
|
|
|
}
|
|
</style> |