Merge branch 'khj'
This commit is contained in:
commit
8c2bbe188b
@ -31,7 +31,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { defineProps, ref } from 'vue';
|
import { defineProps, ref, watch } from 'vue';
|
||||||
|
|
||||||
// lists prop 정의
|
// lists prop 정의
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -43,21 +43,29 @@ const props = defineProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
|
selectedCategory: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: null,
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// 카테고리 선택
|
// 카테고리 선택
|
||||||
const selectedCategory = ref(null);
|
const selectedCategory = ref(props.selectedCategory);
|
||||||
const emit = defineEmits();
|
|
||||||
|
const emit = defineEmits(['update:data']);
|
||||||
const selectCategory = (cate) => {
|
const selectCategory = (cate) => {
|
||||||
selectedCategory.value = selectedCategory.value === cate ? null : cate;
|
selectedCategory.value = selectedCategory.value === cate ? null : cate;
|
||||||
emit('update:data', selectedCategory.value);
|
emit('update:data', selectedCategory.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
watch(() => props.selectedCategory, (newVal) => {
|
||||||
|
selectedCategory.value = newVal;
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.cate-list {
|
.cate-list {
|
||||||
overflow-x: scroll;
|
overflow-x: scroll;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user