Skip to content

Commit e10a6ee

Browse files
authored
fix: VClick component with table element (#1604)
1 parent cf2fee4 commit e10a6ee

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

packages/client/builtin/VClick.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default defineComponent({
3636
at: this.at,
3737
hide: this.hide,
3838
fade: this.fade,
39+
handleSpecialElements: false,
3940
},
4041
{
4142
default: () =>

packages/client/builtin/VClicks.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export default defineComponent({
3434
type: Boolean,
3535
default: false,
3636
},
37+
handleSpecialElements: {
38+
type: Boolean,
39+
default: true,
40+
},
3741
},
3842
render() {
3943
const every = +this.every
@@ -120,21 +124,23 @@ export default defineComponent({
120124
size: +at + Math.ceil((globalIdx - 1) / every) - 1 - execIdx,
121125
})
122126

123-
// handle ul, ol list
124-
if (elements.length === 1 && listTags.includes(elements[0].type as string) && Array.isArray(elements[0].children))
125-
return h(elements[0], {}, [...mapChildren(elements[0].children), lastGap()])
126-
127-
if (elements.length === 1 && elements[0].type as string === 'table') {
128-
const tableNode = elements[0]
129-
if (Array.isArray(tableNode.children)) {
130-
return h(tableNode, {}, tableNode.children.map((i) => {
131-
if (!isVNode(i))
132-
return i
133-
else if (i.type === 'tbody' && Array.isArray(i.children))
134-
return h(i, {}, [...mapChildren(i.children), lastGap()])
135-
else
136-
return h(i)
137-
}))
127+
if (this.handleSpecialElements) {
128+
// handle ul, ol list
129+
if (elements.length === 1 && listTags.includes(elements[0].type as string) && Array.isArray(elements[0].children))
130+
return h(elements[0], {}, [...mapChildren(elements[0].children), lastGap()])
131+
132+
if (elements.length === 1 && elements[0].type as string === 'table') {
133+
const tableNode = elements[0]
134+
if (Array.isArray(tableNode.children)) {
135+
return h(tableNode, {}, tableNode.children.map((i) => {
136+
if (!isVNode(i))
137+
return i
138+
else if (i.type === 'tbody' && Array.isArray(i.children))
139+
return h(i, {}, [...mapChildren(i.children), lastGap()])
140+
else
141+
return h(i)
142+
}))
143+
}
138144
}
139145
}
140146

0 commit comments

Comments
 (0)