vscode can use uni-app, the specific method: 1. Install the vue syntax prompt plug-in vetur; 2. Execute the "npm i @dcloudio/uni-helper-json" command to install the component syntax prompt; 3. Download and Just import the uni-app code that comes with HBuilderX.
The operating environment of this tutorial: Windows 7 system, Visual Studio Code version 1.45.1.0, DELL G3 computer.
uni-app is a framework that uses vue syntax to develop small programs, apps, and H5. The officially recommended development tool is HBuilderX, which provides a good development experience.
However, since HBuilderX does not have a Linux version and many front-ends have been accustomed to vscode before, they do not want to change editors. Directly using vscode to develop uni-app, the experience is not very good.
In fact, uni-app and vscode can also go well together. Next, I will show you the correct opening posture of uni-app in vscode.
npm install -g @vue/cli
vue create -p dcloudio/uni-preset-vue my-project
At this time, you will be prompted to select a project template. For first-time experience, it is recommended to select thehello uni-app
project template, as shown below:
Install the vue syntax prompt plug-in vetur
The CLI project comes with uni-app syntax prompts and 5 App syntax prompts by default
##Installation Component syntax prompts
Component syntax prompts are the highlight of uni-app, which few other frameworks can provide.npm i @dcloudio/uni-helper-json
uni-app code block, put it in the .vscode directory under the project directory to have the same code block as HBuilderX.
##Run project
npm run dev:%PLATFORM%
npm run build:%PLATFORM%
Possible values are as follows:
Platform | |
---|---|
H5 | |
Alipay Mini Program | |
Baidu Mini Program | |
WeChat Mini Program | |
Toutiao Mini Program | |
qq Mini Program |