Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/talltotal/vue-wxqlogo

https://talltotal.github.io/vue-wxqlogo/
https://github.com/talltotal/vue-wxqlogo

qlogo vue wechat wx

Last synced: about 4 hours ago
JSON representation

https://talltotal.github.io/vue-wxqlogo/

Awesome Lists containing this project

README

        

# vue-wxqlogo

微信头像“暂时无法查看”异常处理。
[demo](https://talltotal.github.io/vue-wxqlogo/)

## Installation

```bash
$ npm install vue-wxqlogo
```

OR

```bash
$ yarn add vue-wxqlogo
```

## Usage

main.js:
```js
import Vue from 'Vue'
import VueWxQlogo from 'vue-wxqlogo'
import VueLazyload from 'vue-lazyload'

/**
* options:
* 1. loadingImg |
* 2. defaultImg | string>
*/
Vue.use(VueWxQlogo, {
loadingImg: require('@/assets/imgs/loading'),
defaultImg (key) {
return [
require('@/assets/imgs/logo/1.png'),
require('@/assets/imgs/logo/2.png'),
require('@/assets/imgs/logo/3.png'),
][Number(key) % 3]
}
})
/**
* wxqlogo in VueLazyload
*/
Vue.use(VueLazyload, {
...lazyOptions,
adapter: {
loaded ({ el, src }) {
/**
* Vue.prototype.$loadWxqlogo
* 1. src |
* 2. key |
* 3. handler | <(result: string)=>void>
*/
Vue.prototype.$loadWxqlogo(src, key, (result) => {
el.setAttribute('src', result)
})
}
}
})

/**
* async-await (won't return 'loading' status)
*/
async function fun () {
const result = await Vue.prototype.$loadWxqlogo(src, key)
commit('SET_AVATAR', result)
}
```

template:
```html








```