Getting Started
Installation
Global Installation
1npm install -g ew-auto-import-tool
Or using yarn:
1yarn global add ew-auto-import-tool
Or using pnpm:
1pnpm add -g ew-auto-import-tool
Using npx Directly
You can also run it directly without installation using npx:
Basic Usage
Run the following command in the root directory of your Vue project:
The tool will guide you to select a component library and automatically complete the configuration.
Specify Component Library
You can specify the component library to configure via command line parameters:
1ew-auto-import-tool --library element-plus
Specify Project Path
By default, the tool looks for a Vue project in the current directory. You can also specify the project path:
1ew-auto-import-tool --path /path/to/your/project
View Help
1ew-auto-import-tool --help
After Configuration
After the configuration is complete, you need to:
- Restart the development server
- Use components directly in your components without manual imports
For example:
1<template>
2 <el-button type="primary">Button</el-button>
3 <el-input placeholder="Please input"></el-input>
4</template>
5
6<script setup lang="ts">
7// No need to manually import components
8</script>
Next Steps