- Vue.js 3 Cookbook
- Heitor Ramon Ribeiro
- 380字
- 2021-06-11 18:11:55
Adding plugins to a Vue CLI project with Vue UI
The Vue UI tool is one of the most powerful additional tools for Vue development. It makes a developer's life easier, and at the same time can help manage the Vue projects.
Getting ready
The pre-requisite for this recipe is as follows:
- Node.js 12+
The Node.js global objects that are required are as follows:
- @vue/cli
- @vue/cli-service-global
How to do it...
First, we need to create our Vue CLI project. To find how to create a Vue CLI project, please check the 'Creating your first project with Vue CLI' recipe. We can use the one we created in the last recipe or start a new one. Now, follow the instructions to add a plugin:
- Open the Vue UI interface. Open Terminal (macOS or Linux) or Command Prompt/PowerShell (Windows) and execute the following command:
> vue ui
- A new browser window will appear, with the Vue UI interface:
Here, you can list your projects, create a new project, or import an existing one.
- Now, we will import the one we created:
You need to find the folder that you created and click on Import this folder.
- After the folder is imported, the default Dashboard of the project will appear:
Here, it's possible to customize your Dashboard, adding new widgets, by clicking on the Customize button on the top:
- To add a new plugin, you must click on the Plugins menu in the left-hand sidebar:
The base plugins that you added on the Vue CLI tool will be already listed here.
- Now, we will add the base Vue ecosystem plugins—vuex and vue-router:
- If you check your code, you will see that the main.js file was changed, and the vuex (store) and vue-router (router) plugins are now imported and injected to the Vue instance:
How it works...
The Vue UI plugins work in conjunction with npm or yarn to automatically install the packages on your project, and then inject—when possible—the necessary conditions on the Vue instance.
If a plugin is a visual, directive, or a non-direct instantiated plugin, the Vue UI will install it and manage it, but you need to import it for use on your application.
- 筆記本電腦使用、維護與故障排除實戰
- 極簡Spring Cloud實戰
- Artificial Intelligence Business:How you can profit from AI
- VCD、DVD原理與維修
- Rapid BeagleBoard Prototyping with MATLAB and Simulink
- 筆記本電腦使用、維護與故障排除從入門到精通(第5版)
- 筆記本電腦維修300問
- Machine Learning with Go Quick Start Guide
- 基于Proteus仿真的51單片機應用
- Blender Game Engine:Beginner's Guide
- FL Studio Cookbook
- Exceptional C++:47個C++工程難題、編程問題和解決方案(中文版)
- INSTANT Cinema 4D Starter
- 計算機組裝與維護項目化教程(第二版)
- 多媒體技術教程