용어집 css, 로직변경
This commit is contained in:
parent
5212c4f6d8
commit
fbb42682f0
@ -3,10 +3,8 @@
|
|||||||
<i :class="buttonClass"></i>
|
<i :class="buttonClass"></i>
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch, defineProps } from 'vue';
|
import { ref, watch, defineProps, defineEmits, watchEffect } from 'vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
isToggleEnabled: {
|
isToggleEnabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@ -17,24 +15,20 @@
|
|||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const emit = defineEmits(["click"]);
|
||||||
const buttonClass = ref('bx bx-edit-alt');
|
const buttonClass = ref('bx bx-edit-alt');
|
||||||
|
watchEffect(() => {
|
||||||
watch(
|
buttonClass.value = props.isActive ? 'bx bx-x' : 'bx bx-edit-alt';
|
||||||
() => props.isActive,
|
});
|
||||||
newVal => {
|
const toggleText = (event) => {
|
||||||
buttonClass.value = newVal ? 'bx bx-x' : 'bx bx-edit-alt';
|
// 이벤트 객체를 매개변수로 받아옵니다
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const toggleText = () => {
|
|
||||||
if (props.isToggleEnabled) {
|
if (props.isToggleEnabled) {
|
||||||
buttonClass.value = buttonClass.value === 'bx bx-edit-alt' ? 'bx bx-x' : 'bx bx-edit-alt';
|
buttonClass.value = buttonClass.value === 'bx bx-edit-alt' ? 'bx bx-x' : 'bx bx-edit-alt';
|
||||||
}
|
}
|
||||||
|
emit("click", event); // 이벤트 객체를 같이 전달
|
||||||
};
|
};
|
||||||
const resetButton = () => {
|
const resetButton = () => {
|
||||||
buttonClass.value = 'bx bx-edit-alt';
|
buttonClass.value = 'bx bx-edit-alt';
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({ resetButton });
|
defineExpose({ resetButton });
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -10,13 +10,20 @@
|
|||||||
:titleValue="item.WRDDICTTL"
|
:titleValue="item.WRDDICTTL"
|
||||||
:contentValue="item.WRDDICCON"
|
:contentValue="item.WRDDICCON"
|
||||||
:isDisabled="true"
|
:isDisabled="true"
|
||||||
|
:showEditBtn="true"
|
||||||
|
@toggleEdit="toggleEdit"
|
||||||
/>
|
/>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<div class="d-flex align-ite-center">
|
<div class="d-flex align-items-center justify-content-between">
|
||||||
<div class="w-100 d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<span class="btn btn-primary pe-none">{{ item.category }}</span>
|
<span class="btn btn-primary pe-none">{{ item.category }}</span>
|
||||||
<strong class="mx-2 w-75">{{ item.WRDDICTTL }}</strong>
|
<strong class="mx-2 w-75">{{ item.WRDDICTTL }}</strong>
|
||||||
</div>
|
</div>
|
||||||
|
<EditBtn
|
||||||
|
@click="toggleEdit"
|
||||||
|
:isToggleEnabled="true"
|
||||||
|
:isActive="writeStore.isItemActive(item.WRDDICSEQ)"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<p class="mt-5 dict-content-wrap" v-html="$common.contentToHtml(item.WRDDICCON)"></p>
|
<p class="mt-5 dict-content-wrap" v-html="$common.contentToHtml(item.WRDDICCON)"></p>
|
||||||
<div class="d-flex align-items-start">
|
<div class="d-flex align-items-start">
|
||||||
@ -55,12 +62,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="edit-btn">
|
|
||||||
<EditBtn ref="writeButton" @click="writeStore.toggleItem(item.WRDDICSEQ)" :isToggleEnabled="true"
|
|
||||||
:isActive="writeStore.activeItemId === item.WRDDICSEQ"/>
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
@ -68,7 +69,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import axios from "@api";
|
import axios from "@api";
|
||||||
import { useToastStore } from '@s/toastStore';
|
import { useToastStore } from '@s/toastStore';
|
||||||
import { getCurrentInstance, ref } from 'vue';
|
import { getCurrentInstance, nextTick, ref } from 'vue';
|
||||||
import EditBtn from '@/components/button/EditBtn.vue';
|
import EditBtn from '@/components/button/EditBtn.vue';
|
||||||
import $api from '@api';
|
import $api from '@api';
|
||||||
import DictWrite from './DictWrite.vue';
|
import DictWrite from './DictWrite.vue';
|
||||||
@ -149,11 +150,10 @@ const setDefaultImage = (event) => {
|
|||||||
event.target.src = defaultProfile;
|
event.target.src = defaultProfile;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toggleEdit = async () => {
|
||||||
// 체크 상태 변경 시 부모로 전달
|
writeStore.toggleItem(props.item.WRDDICSEQ);
|
||||||
const toggleCheck = (event) => {
|
|
||||||
emit('updateChecked', event.target.checked, props.item.WRDDICSEQ, event.target.name);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="dataList.length > 0" >
|
<div v-if="dataList.length > 0" >
|
||||||
<FormSelect
|
<FormSelect
|
||||||
class="me-5"
|
|
||||||
name="cate"
|
name="cate"
|
||||||
title="카테고리"
|
title="카테고리"
|
||||||
:data="dataList"
|
:data="dataList"
|
||||||
@ -13,15 +12,21 @@
|
|||||||
:is-btn="true"
|
:is-btn="true"
|
||||||
>
|
>
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
<div v-if="!isDisabled">
|
<div>
|
||||||
<PlusBtn @click="toggleInput"/>
|
<PlusBtn v-if="!showInput && !isDisabled" @click="toggleInput"/>
|
||||||
|
<EditBtn
|
||||||
|
v-if="showEditBtn"
|
||||||
|
@click="$emit('toggleEdit')"
|
||||||
|
:isToggleEnabled="true"
|
||||||
|
:isActive="writeStore.isItemActive(NumValue)"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</FormSelect>
|
</FormSelect>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="dataList.length === 0 || showInput">
|
<div v-if="dataList.length === 0 || showInput">
|
||||||
<FormInput
|
<FormInput
|
||||||
class="me-5 justify-content-end"
|
class="justify-content-end"
|
||||||
ref="categoryInputRef"
|
ref="categoryInputRef"
|
||||||
title="새 카테고리"
|
title="새 카테고리"
|
||||||
:isLabel="dataList.length === 0 ?true : false"
|
:isLabel="dataList.length === 0 ?true : false"
|
||||||
@ -32,7 +37,7 @@
|
|||||||
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<FormInput class="me-5"
|
<FormInput
|
||||||
title="용어"
|
title="용어"
|
||||||
type="text"
|
type="text"
|
||||||
name="word"
|
name="word"
|
||||||
@ -60,8 +65,12 @@ import QEditor from '@/components/editor/QEditor.vue';
|
|||||||
import FormInput from '@/components/input/FormInput.vue';
|
import FormInput from '@/components/input/FormInput.vue';
|
||||||
import FormSelect from '@/components/input/FormSelect.vue';
|
import FormSelect from '@/components/input/FormSelect.vue';
|
||||||
import PlusBtn from '../button/PlusBtn.vue';
|
import PlusBtn from '../button/PlusBtn.vue';
|
||||||
|
import EditBtn from '../button/EditBtn.vue';
|
||||||
|
import { useWriteVisibleStore } from '@s/writeVisible';
|
||||||
|
|
||||||
const emit = defineEmits(['close','addCategory','addWord']);
|
const writeStore = useWriteVisibleStore();
|
||||||
|
|
||||||
|
const emit = defineEmits(['close','addCategory','addWord', 'toggleEdit']);
|
||||||
|
|
||||||
//용어제목
|
//용어제목
|
||||||
const wordTitle = ref('');
|
const wordTitle = ref('');
|
||||||
@ -110,6 +119,10 @@ const props = defineProps({
|
|||||||
isDisabled: {
|
isDisabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
showEditBtn: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -27,11 +27,10 @@
|
|||||||
<!-- 용어 리스트 -->
|
<!-- 용어 리스트 -->
|
||||||
<div>
|
<div>
|
||||||
<!-- 에러 메시지 -->
|
<!-- 에러 메시지 -->
|
||||||
<div v-if="error" class="error">{{ error }}</div>
|
<div v-if="error" class="fw-bold text-danger">{{ error }}</div>
|
||||||
<!-- 단어 목록 -->
|
<!-- 단어 목록 -->
|
||||||
<ul v-if="total > 0" class="ms-3 list-unstyled">
|
<ul v-if="total > 0" class="ms-3 list-unstyled">
|
||||||
<DictCard
|
<DictCard
|
||||||
class="DictCard"
|
|
||||||
v-for="item in wordList"
|
v-for="item in wordList"
|
||||||
:key="item.WRDDICSEQ"
|
:key="item.WRDDICSEQ"
|
||||||
:item="item"
|
:item="item"
|
||||||
@ -268,21 +267,13 @@
|
|||||||
width: 3rem;
|
width: 3rem;
|
||||||
height: 3rem;
|
height: 3rem;
|
||||||
}
|
}
|
||||||
.error {
|
|
||||||
color: red;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.title {
|
|
||||||
margin-bottom: 0.5rem !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.DictCard {
|
.DictCard {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user