fix: 修复attrs透传会触发两次select事件 (#138)

This commit is contained in:
dayou 2024-05-23 11:39:09 +08:00 committed by sudoooooo
parent 0b0f78a3ed
commit 8ce6dc7607
2 changed files with 8 additions and 8 deletions

View File

@ -10,7 +10,6 @@
>
<template #item="{ element, index }">
<QuestionWrapper
v-bind="$attrs"
:ref="`questionWrapper-${element.field}`"
:moduleConfig="element"
:qIndex="element.qIndex"
@ -18,15 +17,15 @@
:isSelected="currentEditOne === index"
:isLast="index + 1 === questionDataList.length"
@select="handleSelect"
@changeSeq="handleChangeSeq"
>
<QuestionContainerB
v-bind="$attrs"
:type="element.type"
:moduleConfig="element"
:indexNumber="element.indexNumber"
:isSelected="currentEditOne === index"
:readonly="true"
@select="handleSelect"
@change="handleChange"
></QuestionContainerB>
</QuestionWrapper>
</template>
@ -60,9 +59,9 @@ export default defineComponent({
}
}
},
emits: ['change', 'select', 'changeSeq'],
setup(props, { emit }) {
const store = useStore()
const renderData = computed({
get () {
return filterQuestionPreviewData(props.questionDataList)
@ -72,8 +71,12 @@ export default defineComponent({
}
})
const handleSelect = (index) => {
console.log('materialGroup-handleSelect', index)
emit('select', index)
}
const handleChange = (data) => {
emit('change', data)
}
const handleChangeSeq = (data) => {
emit('changeSeq', data)
}
@ -102,6 +105,7 @@ export default defineComponent({
DND_GROUP,
renderData,
handleSelect,
handleChange,
handleChangeSeq,
checkMove,
checkEnd,

View File

@ -75,14 +75,10 @@ export default defineComponent({
const onChange = (data) => {
emit('change', data)
}
const onClick = () => {
emit('select', props.indexNumber)
}
return {
props,
BlockComponent,
onClick,
onBlur,
onFocus,
onChange,