Skip to content

Commit 6304a1b

Browse files
committed
fix: attributes should fall onto the root for Vue 2 (#670)
1 parent e44c9df commit 6304a1b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ECharts.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,11 @@ export default defineComponent({
281281
};
282282
},
283283
render() {
284-
const attrs = { ...this.nonEventAttrs };
284+
// Vue 3 and Vue 2 have different vnode props format:
285+
// See https://v3-migration.vuejs.org/breaking-changes/render-function-api.html#vnode-props-format
286+
const attrs = (
287+
Vue2 ? { attrs: this.nonEventAttrs } : { ...this.nonEventAttrs }
288+
) as any;
285289
attrs.ref = "root";
286290
attrs.class = attrs.class ? ["echarts"].concat(attrs.class) : "echarts";
287291
return h(TAG_NAME, attrs);

0 commit comments

Comments
 (0)