fix: 连续添加题目频繁触发事件导致页面卡顿
This commit is contained in:
parent
fd7cc2ea96
commit
b233023bb3
@ -19,11 +19,14 @@
|
|||||||
class="qtopic-item"
|
class="qtopic-item"
|
||||||
:id="'qtopic' + element.type"
|
:id="'qtopic' + element.type"
|
||||||
@click="onQuestionType({ type: element.type })"
|
@click="onQuestionType({ type: element.type })"
|
||||||
@mouseenter="showPreview(element, 'qtopic' + element.type)"
|
|
||||||
@mouseleave="isShowPreviewImage = false"
|
|
||||||
@mousedown="isShowPreviewImage = false"
|
|
||||||
>
|
>
|
||||||
<i class="iconfont" :class="['icon-' + element.icon]"></i>
|
<i
|
||||||
|
class="iconfont"
|
||||||
|
:class="['icon-' + element.icon]"
|
||||||
|
@mouseenter="showPreview(element, 'qtopic' + element.type)"
|
||||||
|
@mouseleave="isShowPreviewImage = false"
|
||||||
|
@mousedown="isShowPreviewImage = false"
|
||||||
|
></i>
|
||||||
<p class="text">{{ element.title }}</p>
|
<p class="text">{{ element.title }}</p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -46,11 +49,11 @@ import { DND_GROUP } from '@/management/config/dnd'
|
|||||||
import questionMenuConfig, { questionTypeList } from '@/management/config/questionMenuConfig'
|
import questionMenuConfig, { questionTypeList } from '@/management/config/questionMenuConfig'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import { useEditStore } from '@/management/stores/edit'
|
import { useEditStore } from '@/management/stores/edit'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const editStore = useEditStore()
|
const editStore = useEditStore()
|
||||||
const { newQuestionIndex } = storeToRefs(editStore)
|
const { newQuestionIndex } = storeToRefs(editStore)
|
||||||
const { addQuestion, setCurrentEditOne,createNewQuestion } = editStore
|
const { addQuestion, setCurrentEditOne, createNewQuestion } = editStore
|
||||||
|
|
||||||
const activeNames = ref([0, 1])
|
const activeNames = ref([0, 1])
|
||||||
const previewImg = ref('')
|
const previewImg = ref('')
|
||||||
@ -61,7 +64,6 @@ questionLoader.init({
|
|||||||
typeList: questionTypeList.map((item) => item.type)
|
typeList: questionTypeList.map((item) => item.type)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
const onQuestionType = ({ type }) => {
|
const onQuestionType = ({ type }) => {
|
||||||
const newQuestion = createNewQuestion({ type })
|
const newQuestion = createNewQuestion({ type })
|
||||||
addQuestion({ question: newQuestion, index: newQuestionIndex.value })
|
addQuestion({ question: newQuestion, index: newQuestionIndex.value })
|
||||||
|
Loading…
Reference in New Issue
Block a user