Failed to resolve import "ant-design-vue/dist/antd.css" from "src\main.js". Does the file exist?
时间: 2023-07-17 14:03:39 浏览: 516
I apologize for the confusion. In Vue 3.0, the way to import CSS files has changed. Instead of importing CSS files directly in the main.js file, you need to import and register it in the individual component where you want to use it.
To fix the "Failed to resolve import" error, you can follow these steps:
1. Remove the line `import 'ant-design-vue/dist/antd.css';` from your main.js file.
2. Open the component where you want to use Ant Design Vue components (e.g., HelloWorld.vue).
3. Import the required CSS file at the top of the component file, like this:
```javascript
<style>
@import 'ant-design-vue/dist/antd.css';
</style>
```
4. Save the file and run your Vue project again.
By importing the CSS file directly in the component file, you can ensure that the styles are applied only to that specific component and not globally.
I hope this helps! Let me know if you have any further questions.
阅读全文