fix: 连续添加题目频繁触发事件导致页面卡顿

This commit is contained in:
sudoooooo 2024-08-12 16:08:57 +08:00
parent fd7cc2ea96
commit b233023bb3

View File

@ -19,11 +19,14 @@
class="qtopic-item"
:id="'qtopic' + element.type"
@click="onQuestionType({ type: element.type })"
>
<i
class="iconfont"
:class="['icon-' + element.icon]"
@mouseenter="showPreview(element, 'qtopic' + element.type)"
@mouseleave="isShowPreviewImage = false"
@mousedown="isShowPreviewImage = false"
>
<i class="iconfont" :class="['icon-' + element.icon]"></i>
></i>
<p class="text">{{ element.title }}</p>
</div>
</template>
@ -50,7 +53,7 @@ import { ref } from 'vue'
const editStore = useEditStore()
const { newQuestionIndex } = storeToRefs(editStore)
const { addQuestion, setCurrentEditOne,createNewQuestion } = editStore
const { addQuestion, setCurrentEditOne, createNewQuestion } = editStore
const activeNames = ref([0, 1])
const previewImg = ref('')
@ -61,7 +64,6 @@ questionLoader.init({
typeList: questionTypeList.map((item) => item.type)
})
const onQuestionType = ({ type }) => {
const newQuestion = createNewQuestion({ type })
addQuestion({ question: newQuestion, index: newQuestionIndex.value })