Skip to content

Function h from vue can't render antd Components #4163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task
BigDeep opened this issue Jun 4, 2021 · 3 comments
Closed
1 task

Function h from vue can't render antd Components #4163

BigDeep opened this issue Jun 4, 2021 · 3 comments
Labels

Comments

@BigDeep
Copy link

BigDeep commented Jun 4, 2021

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

2.1.4

Environment

os:macOS Vue:3.0.4

Reproduction link

https://github.com/vueComponent/ant-design-vue

Steps to reproduce

follow the step below

customRender: (data: unknown) => {
return h(
'a-button',
{
style: { cursor: 'pointer' },
onClick: () => {
console.log(data)
},
type: 'primary',
size: 'small',
},
'edit',
)
},

I found that i can't render a "a-button" , but i can render it while import {Button} from 'ant-design-vue' like below

import { Button } from 'ant-design-vue'
customRender: (data: unknown) => {
return h(
Button,
{
style: { cursor: 'pointer' },
onClick: () => {
console.log(data)
},
type: 'primary',
size: 'small',
},
'edit',
)
},

What is expected?

I had global inject antd ,but when i use ”h “ from vue i can't render an antd components by componentsName,
must import it and put it as a parameter into the function h

What is actually happening?

follow the step below

customRender: (data: unknown) => {
return h(
'a-button',
{
style: { cursor: 'pointer' },
onClick: () => {
console.log(data)
},
type: 'primary',
size: 'small',
},
'edit',
)
},

I found that i can't render a "a-button" , but i can render it while import {Button} from 'ant-design-vue' like below

import { Button } from 'ant-design-vue'
customRender: (data: unknown) => {
return h(
Button,
{
style: { cursor: 'pointer' },
onClick: () => {
console.log(data)
},
type: 'primary',
size: 'small',
},
'edit',
)
},
@John60676
Copy link
Member

Reference: vuejs/core#1927 (comment)

@BigDeep
Copy link
Author

BigDeep commented Jun 4, 2021

Reference: vuejs/vue-next#1927 (comment)

thanks,it works

@BigDeep BigDeep closed this as completed Jun 4, 2021
@github-actions
Copy link

github-actions bot commented Jun 5, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants