Skip to content

Custom SVG icon problem #3975

@bao2314483

Description

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

Version

2.1.1

Environment

2.1.1

Reproduction link

http://localhost:3000

Steps to reproduce

https://2x.antdv.com/components/icon-cn参考Icon文档自定义 SVG 图标

What is expected?

What is actually happening?

我包的配置如下

{
"name": "testweb",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"serve": "vite preview"
},
"dependencies": {
"ant-design-vue": "^2.1.2",
"vue": "^3.0.5",
"vue-router": "^4.0.6",
"vuex": "^4.0.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^1.2.1",
"@vue/compiler-sfc": "^3.0.5",
"typescript": "^4.1.3",
"vite": "^2.1.5",
"vue-tsc": "^0.0.24"
}
}

import { defineComponent } from 'vue';
import Icon from '@ant-design/icons-vue';
import MessageSvg from 'path/to/message.svg'; // '*.svg' 文件的路径

export default defineComponent({
setup() {
return () => <Icon type={MessageSvg} />;
},
});

会提示错误Expected ">" but found "type"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions