Skip to content
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

@mdui/icons 的组件在 Vue 中报错 TS2551 #369

Open
Super12138 opened this issue Jan 4, 2025 · 3 comments
Open

@mdui/icons 的组件在 Vue 中报错 TS2551 #369

Super12138 opened this issue Jan 4, 2025 · 3 comments

Comments

@Super12138
Copy link

Super12138 commented Jan 4, 2025

在使用@mdui/icons组件导入图标后,报错 TS2551
TS2551
打包也会报错:

error TS2551: Property 'MduiIconSearchOutlined' does not exist on type '{ "MduiIconSearch-Outlined": unknown; }'. Did you mean 'MduiIconSearch-Outlined'?

代码精简过后是这样的:

<script setup lang="ts">
import '@mdui/icons/search--outlined.js';
</script>

<template>
    <mdui-icon-search--outlined></mdui-icon-search--outlined>
</template>

已经确保在vite.config.ts中添加:

vue({
    template: {
        compilerOptions: {
            isCustomElement: (tag) => tag.startsWith('mdui-')
        }
    }
})

使用的相关依赖及版本:

  • TypeScript: v5.7.2
  • mdui: v2.1.3
  • @mdui/icons: v1.0.2
  • Vue.js: v3.5.13
  • Node.js: v23.5.0
@zdhxiong
Copy link
Owner

zdhxiong commented Jan 4, 2025

无法复现。
请给出能复现的在线演示。

@Super12138
Copy link
Author

无法复现。 请给出能复现的在线演示。

在这里:https://stackblitz.com/edit/vitejs-vite-nbaqvqkc

@Super12138
Copy link
Author

还发现一个有意思的事情,在使用非 Outlined、Rounded、Sharp、Two tone 带后缀 -- 的标签时(就是Filled),如<mdui-icon-search>就不会触发报错,只有带 -- 才会。

Filled 样式:
Filled 样式
Rounded 样式:
Rounded 样式

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants