Skip to content

Commit

Permalink
fix: 修复attrs透传会触发两次select事件 (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
skique committed May 23, 2024
1 parent 58ab49e commit 734e33e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 8 additions & 4 deletions web/src/management/pages/edit/components/MaterialGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,22 @@
>
<template #item="{ element, index }">
<QuestionWrapper
v-bind="$attrs"
:ref="`questionWrapper-${element.field}`"
:moduleConfig="element"
:qIndex="element.qIndex"
:indexNumber="element.indexNumber"
: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>
Expand Down Expand Up @@ -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)
Expand All @@ -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)
}
Expand Down Expand Up @@ -102,6 +105,7 @@ export default defineComponent({
DND_GROUP,
renderData,
handleSelect,
handleChange,
handleChangeSeq,
checkMove,
checkEnd,
Expand Down
4 changes: 0 additions & 4 deletions web/src/materials/questions/QuestionContainerB/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 734e33e

Please sign in to comment.