uni-app npm method to install and use

1. Open the debug command window of the corresponding project

1. Search for cmd in the lower left corner of the computer, click the command prompt, enter cd + space + project address, and press Enter:

2. In the current directory "shift + right mouse button", click "Open Powershell window here":

2. Enter the command to initialize npm

npm init -y

3. Installation package

npm install @dcloudio/uni-ui

4. Introduction and use

1. Global installation: In main.js:

import {uniBadge} from '@dcloudio/uni-ui'

2. Local installation: (In the case of developing projects, local installation should be used instead of global installation, as explained in the uni-app article)

import {uniBadge} from '@dcloudio/uni-ui'
//import uniBadge from '@dcloudio/uni-ui/lib/uni-badge/uni-badge.vue' //也可使用此方式引入组件
export default {
    components: {uniBadge}
}

5. Finally, you can use the command to install other plugins you want after seeing node_modules in your project

Guess you like

Origin blog.csdn.net/weixin_44285250/article/details/108518883