# Install
```bash
npm install apifm-uniapp
```
Run this command to install the latest version of the SDK with one click
# use
## Globally load SDK
Open the `main.js` file and initialize the SDK globally
```javascript
import WXAPI from 'apifm-uniapp'
WXAPI.init('gooking')
WXAPI.setMerchantId(2)
Vue.prototype.$wxapi = WXAPI
```
## Call methods in SDK
There are two ways to call the interface:
### Method 1
No need to introduce, call directly:
```javascript
this.$wxapi.banners().then(res => {
if (res.code == 0) {
this.setData({
banners: res.data
})
}
})
```
Or:
```javascript
const res = await this.$wxapi.banners()
if (res.code == 0) {
this.setData({
banners: res.data
})
}
```
### Method 2
js file to load the SDK directly:
```javascript
const WXAPI = require('apifm-uniapp')
```
At this time, there is no need for `WEBAPI.init('gooking')`, because it has been set globally.
```javascript
WXAPI.banners().then(res => {
if (res.code == 0) {
this.setData({
banners: res.data
})
}
})
```
Or:
```javascript
const res = await WXAPI.banners()
if (res.code == 0) {
this.setData({
banners: res.data
})
}
```